From 2a1d84123ccee469670cef4ec75d0ab31da65133 Mon Sep 17 00:00:00 2001 From: jaymode Date: Tue, 4 Feb 2020 21:18:39 -0700 Subject: [PATCH 01/11] RestHandlers declare handled methods and paths This commit changes how RestHandlers are registered with the RestController so that a RestHandler no longer needs to register itself with the RestController. Instead the RestHandler interface has new methods which when called provide information about the method and path combinations that are handled by the handler including any deprecated and/or replaced combinations. This change also makes the publication of RestHandlers safe since they no longer publish a reference to themselves within their constructors. Closes #51622 --- .../elasticsearch/plugin/noop/NoopPlugin.java | 4 +- .../noop/action/bulk/RestNoopBulkAction.java | 19 +- .../action/search/RestNoopSearchAction.java | 20 +- .../ingest/common/GrokProcessorGetAction.java | 11 +- .../ingest/common/IngestCommonPlugin.java | 2 +- .../script/mustache/MustachePlugin.java | 6 +- .../RestMultiSearchTemplateAction.java | 23 +- .../RestRenderSearchTemplateAction.java | 19 +- .../mustache/RestSearchTemplateAction.java | 18 +- .../painless/PainlessPlugin.java | 4 +- .../action/PainlessContextAction.java | 9 +- .../action/PainlessExecuteAction.java | 12 +- .../index/rankeval/RankEvalPlugin.java | 3 +- .../index/rankeval/RestRankEvalAction.java | 19 +- .../index/reindex/ReindexPlugin.java | 8 +- .../reindex/RestDeleteByQueryAction.java | 13 +- .../index/reindex/RestReindexAction.java | 14 +- .../index/reindex/RestRethrottleAction.java | 21 +- .../reindex/RestUpdateByQueryAction.java | 14 +- .../index/reindex/RestReindexActionTests.java | 3 +- .../example/resthandler/ExampleCatAction.java | 14 +- .../resthandler/ExampleRestHandlerPlugin.java | 2 +- .../elasticsearch/DieWithDignityPlugin.java | 2 +- .../RestDieWithDignityAction.java | 16 +- .../http/TestDeprecationHeaderRestAction.java | 20 +- .../http/TestDeprecationPlugin.java | 2 +- .../http/TestResponseHeaderPlugin.java | 2 +- .../http/TestResponseHeaderRestAction.java | 14 +- .../elasticsearch/action/ActionModule.java | 251 +++++++++--------- .../common/collect/MapBuilder.java | 2 +- .../elasticsearch/rest/BaseRestHandler.java | 9 + .../elasticsearch/rest/RestController.java | 19 +- .../org/elasticsearch/rest/RestHandler.java | 106 ++++++++ .../action/RestFieldCapabilitiesAction.java | 19 +- .../rest/action/RestMainAction.java | 14 +- .../RestAddVotingConfigExclusionAction.java | 20 +- .../admin/cluster/RestCancelTasksAction.java | 19 +- .../cluster/RestCleanupRepositoryAction.java | 14 +- ...RestClearVotingConfigExclusionsAction.java | 16 +- .../RestClusterAllocationExplainAction.java | 19 +- .../cluster/RestClusterGetSettingsAction.java | 19 +- .../cluster/RestClusterHealthAction.java | 16 +- .../cluster/RestClusterRerouteAction.java | 18 +- .../RestClusterSearchShardsAction.java | 19 +- .../admin/cluster/RestClusterStateAction.java | 23 +- .../admin/cluster/RestClusterStatsAction.java | 18 +- .../RestClusterUpdateSettingsAction.java | 15 +- .../cluster/RestCreateSnapshotAction.java | 16 +- .../cluster/RestDeleteRepositoryAction.java | 14 +- .../cluster/RestDeleteSnapshotAction.java | 14 +- .../cluster/RestDeleteStoredScriptAction.java | 14 +- .../cluster/RestGetRepositoriesAction.java | 19 +- .../cluster/RestGetScriptContextAction.java | 14 +- .../cluster/RestGetScriptLanguageAction.java | 14 +- .../admin/cluster/RestGetSnapshotsAction.java | 11 +- .../cluster/RestGetStoredScriptAction.java | 11 +- .../admin/cluster/RestGetTaskAction.java | 11 +- .../admin/cluster/RestListTasksAction.java | 14 +- .../cluster/RestNodesHotThreadsAction.java | 31 ++- .../admin/cluster/RestNodesInfoAction.java | 28 +- .../admin/cluster/RestNodesStatsAction.java | 25 +- .../admin/cluster/RestNodesUsageAction.java | 23 +- .../RestPendingClusterTasksAction.java | 13 +- .../cluster/RestPutRepositoryAction.java | 13 +- .../cluster/RestPutStoredScriptAction.java | 19 +- .../RestReloadSecureSettingsAction.java | 20 +- .../cluster/RestRemoteClusterInfoAction.java | 12 +- .../cluster/RestRestoreSnapshotAction.java | 11 +- .../cluster/RestSnapshotsStatusAction.java | 18 +- .../cluster/RestVerifyRepositoryAction.java | 11 +- .../admin/indices/RestAnalyzeAction.java | 19 +- .../indices/RestClearIndicesCacheAction.java | 16 +- .../admin/indices/RestCloseIndexAction.java | 18 +- .../admin/indices/RestCreateIndexAction.java | 15 +- .../admin/indices/RestDeleteIndexAction.java | 18 +- .../RestDeleteIndexTemplateAction.java | 13 +- .../action/admin/indices/RestFlushAction.java | 20 +- .../admin/indices/RestForceMergeAction.java | 16 +- .../admin/indices/RestGetAliasesAction.java | 26 +- .../indices/RestGetFieldMappingAction.java | 15 +- .../indices/RestGetIndexTemplateAction.java | 19 +- .../admin/indices/RestGetIndicesAction.java | 13 +- .../admin/indices/RestGetMappingAction.java | 20 +- .../admin/indices/RestGetSettingsAction.java | 22 +- .../indices/RestIndexDeleteAliasesAction.java | 16 +- .../indices/RestIndexPutAliasAction.java | 34 +-- .../indices/RestIndicesAliasesAction.java | 11 +- .../indices/RestIndicesSegmentsAction.java | 16 +- .../indices/RestIndicesShardStoresAction.java | 16 +- .../admin/indices/RestIndicesStatsAction.java | 18 +- .../admin/indices/RestOpenIndexAction.java | 18 +- .../indices/RestPutIndexTemplateAction.java | 18 +- .../admin/indices/RestPutMappingAction.java | 20 +- .../admin/indices/RestRecoveryAction.java | 16 +- .../admin/indices/RestRefreshAction.java | 20 +- .../admin/indices/RestResizeHandler.java | 28 +- .../indices/RestRolloverIndexAction.java | 20 +- .../admin/indices/RestSyncedFlushAction.java | 20 +- .../indices/RestUpdateSettingsAction.java | 17 +- .../indices/RestUpgradeActionDeprecated.java | 23 +- .../RestUpgradeStatusActionDeprecated.java | 23 +- .../indices/RestValidateQueryAction.java | 19 +- .../rest/action/cat/RestAliasAction.java | 15 +- .../rest/action/cat/RestAllocationAction.java | 17 +- .../rest/action/cat/RestCatAction.java | 15 +- .../action/cat/RestCatRecoveryAction.java | 15 +- .../rest/action/cat/RestCountAction.java | 17 +- .../rest/action/cat/RestFielddataAction.java | 17 +- .../rest/action/cat/RestHealthAction.java | 11 +- .../rest/action/cat/RestIndicesAction.java | 14 +- .../rest/action/cat/RestMasterAction.java | 12 +- .../rest/action/cat/RestNodeAttrsAction.java | 10 +- .../rest/action/cat/RestNodesAction.java | 11 +- .../cat/RestPendingClusterTasksAction.java | 12 +- .../rest/action/cat/RestPluginsAction.java | 12 +- .../action/cat/RestRepositoriesAction.java | 12 +- .../rest/action/cat/RestSegmentsAction.java | 14 +- .../rest/action/cat/RestShardsAction.java | 16 +- .../rest/action/cat/RestSnapshotAction.java | 14 +- .../rest/action/cat/RestTasksAction.java | 13 +- .../rest/action/cat/RestTemplatesAction.java | 17 +- .../rest/action/cat/RestThreadPoolAction.java | 14 +- .../rest/action/document/RestBulkAction.java | 23 +- .../action/document/RestDeleteAction.java | 11 +- .../rest/action/document/RestGetAction.java | 20 +- .../action/document/RestGetSourceAction.java | 13 +- .../rest/action/document/RestIndexAction.java | 50 ++-- .../action/document/RestMultiGetAction.java | 23 +- .../document/RestMultiTermVectorsAction.java | 19 +- .../document/RestTermVectorsAction.java | 19 +- .../action/document/RestUpdateAction.java | 11 +- .../ingest/RestDeletePipelineAction.java | 13 +- .../action/ingest/RestGetPipelineAction.java | 18 +- .../action/ingest/RestPutPipelineAction.java | 13 +- .../ingest/RestSimulatePipelineAction.java | 22 +- .../action/search/RestClearScrollAction.java | 17 +- .../rest/action/search/RestCountAction.java | 19 +- .../rest/action/search/RestExplainAction.java | 13 +- .../action/search/RestMultiSearchAction.java | 21 +- .../rest/action/search/RestSearchAction.java | 22 +- .../action/search/RestSearchScrollAction.java | 22 +- .../action/ActionModuleTests.java | 34 ++- .../forcemerge/RestForceMergeActionTests.java | 2 +- .../rest/BaseRestHandlerTests.java | 45 ++++ .../rest/RestControllerTests.java | 21 -- ...stAddVotingConfigExclusionActionTests.java | 3 +- .../cluster/RestNodesStatsActionTests.java | 7 +- .../admin/indices/RestAnalyzeActionTests.java | 4 +- .../indices/RestIndicesStatsActionTests.java | 7 +- .../indices/RestValidateQueryActionTests.java | 3 +- .../cat/RestCatRecoveryActionTests.java | 3 +- .../action/cat/RestIndicesActionTests.java | 3 +- .../rest/action/cat/RestNodesActionTests.java | 6 +- .../action/document/RestBulkActionTests.java | 8 +- .../document/RestGetSourceActionTests.java | 2 +- .../action/document/RestIndexActionTests.java | 9 +- .../document/RestUpdateActionTests.java | 3 +- .../scroll/RestClearScrollActionTests.java | 5 +- .../scroll/RestSearchScrollActionTests.java | 5 +- .../DedicatedClusterSnapshotRestoreIT.java | 8 +- .../usage/UsageServiceTests.java | 8 + .../java/org/elasticsearch/xpack/ccr/Ccr.java | 26 +- .../xpack/ccr/rest/RestCcrStatsAction.java | 14 +- .../RestDeleteAutoFollowPatternAction.java | 13 +- .../xpack/ccr/rest/RestFollowInfoAction.java | 14 +- .../xpack/ccr/rest/RestFollowStatsAction.java | 14 +- .../ccr/rest/RestForgetFollowerAction.java | 15 +- .../rest/RestGetAutoFollowPatternAction.java | 18 +- .../RestPauseAutoFollowPatternAction.java | 13 +- .../xpack/ccr/rest/RestPauseFollowAction.java | 13 +- .../rest/RestPutAutoFollowPatternAction.java | 12 +- .../xpack/ccr/rest/RestPutFollowAction.java | 12 +- .../RestResumeAutoFollowPatternAction.java | 13 +- .../ccr/rest/RestResumeFollowAction.java | 12 +- .../xpack/ccr/rest/RestUnfollowAction.java | 13 +- .../org/elasticsearch/license/Licensing.java | 14 +- .../license/RestDeleteLicenseAction.java | 13 +- .../license/RestGetBasicStatus.java | 14 +- .../license/RestGetLicenseAction.java | 12 +- .../license/RestGetTrialStatus.java | 14 +- .../license/RestPostStartBasicLicense.java | 13 +- .../license/RestPostStartTrialLicense.java | 12 +- .../license/RestPutLicenseAction.java | 15 +- .../elasticsearch/xpack/core/XPackPlugin.java | 6 +- .../action/RestReloadAnalyzersAction.java | 17 +- .../core/rest/action/RestXPackInfoAction.java | 14 +- .../rest/action/RestXPackUsageAction.java | 11 +- .../rest/RestGetCertificateInfoAction.java | 12 +- .../xpack/deprecation/Deprecation.java | 2 +- .../RestDeprecationInfoAction.java | 23 +- .../xpack/enrich/EnrichPlugin.java | 10 +- .../rest/RestDeleteEnrichPolicyAction.java | 13 +- .../enrich/rest/RestEnrichStatsAction.java | 13 +- .../rest/RestExecuteEnrichPolicyAction.java | 16 +- .../rest/RestGetEnrichPolicyAction.java | 20 +- .../rest/RestPutEnrichPolicyAction.java | 13 +- .../xpack/eql/plugin/EqlPlugin.java | 2 +- .../xpack/eql/plugin/RestEqlSearchAction.java | 22 +- .../xpack/frozen/FrozenIndices.java | 2 +- .../rest/action/RestFreezeIndexAction.java | 19 +- .../org/elasticsearch/xpack/graph/Graph.java | 2 +- .../graph/rest/action/RestGraphAction.java | 12 +- .../xpack/ilm/IndexLifecycle.java | 38 +-- .../ilm/action/RestDeleteLifecycleAction.java | 14 +- .../action/RestExplainLifecycleAction.java | 14 +- .../ilm/action/RestGetLifecycleAction.java | 19 +- .../xpack/ilm/action/RestGetStatusAction.java | 14 +- .../ilm/action/RestMoveToStepAction.java | 13 +- .../ilm/action/RestPutLifecycleAction.java | 13 +- .../RestRemoveIndexLifecyclePolicyAction.java | 14 +- .../xpack/ilm/action/RestRetryAction.java | 14 +- .../xpack/ilm/action/RestStartILMAction.java | 14 +- .../xpack/ilm/action/RestStopAction.java | 14 +- .../RestDeleteSnapshotLifecycleAction.java | 14 +- .../RestExecuteSnapshotLifecycleAction.java | 17 +- .../RestExecuteSnapshotRetentionAction.java | 14 +- .../slm/action/RestGetSLMStatusAction.java | 14 +- .../RestGetSnapshotLifecycleAction.java | 19 +- .../RestGetSnapshotLifecycleStatsAction.java | 14 +- .../RestPutSnapshotLifecycleAction.java | 13 +- .../xpack/slm/action/RestStartSLMAction.java | 14 +- .../xpack/slm/action/RestStopSLMAction.java | 14 +- .../xpack/ml/MachineLearning.java | 122 ++++----- .../ml/rest/RestDeleteExpiredDataAction.java | 21 +- .../ml/rest/RestFindFileStructureAction.java | 20 +- .../xpack/ml/rest/RestMlInfoAction.java | 21 +- .../ml/rest/RestSetUpgradeModeAction.java | 21 +- .../calendar/RestDeleteCalendarAction.java | 20 +- .../RestDeleteCalendarEventAction.java | 24 +- .../calendar/RestDeleteCalendarJobAction.java | 24 +- .../calendar/RestGetCalendarEventsAction.java | 20 +- .../rest/calendar/RestGetCalendarsAction.java | 38 +-- .../calendar/RestPostCalendarEventAction.java | 20 +- .../rest/calendar/RestPutCalendarAction.java | 21 +- .../calendar/RestPutCalendarJobAction.java | 26 +- .../ml/rest/cat/RestCatDatafeedsAction.java | 17 +- .../xpack/ml/rest/cat/RestCatJobsAction.java | 17 +- .../rest/cat/RestCatTrainedModelsAction.java | 15 +- .../datafeeds/RestDeleteDatafeedAction.java | 20 +- .../datafeeds/RestGetDatafeedStatsAction.java | 27 +- .../datafeeds/RestGetDatafeedsAction.java | 26 +- .../datafeeds/RestPreviewDatafeedAction.java | 21 +- .../rest/datafeeds/RestPutDatafeedAction.java | 21 +- .../datafeeds/RestStartDatafeedAction.java | 21 +- .../datafeeds/RestStopDatafeedAction.java | 21 +- .../datafeeds/RestUpdateDatafeedAction.java | 21 +- .../RestDeleteDataFrameAnalyticsAction.java | 16 +- .../RestEvaluateDataFrameAction.java | 13 +- .../RestExplainDataFrameAnalyticsAction.java | 24 +- .../RestGetDataFrameAnalyticsAction.java | 20 +- .../RestGetDataFrameAnalyticsStatsAction.java | 20 +- .../RestPutDataFrameAnalyticsAction.java | 15 +- .../RestStartDataFrameAnalyticsAction.java | 16 +- .../RestStopDataFrameAnalyticsAction.java | 16 +- .../rest/filter/RestDeleteFilterAction.java | 21 +- .../ml/rest/filter/RestGetFiltersAction.java | 28 +- .../ml/rest/filter/RestPutFilterAction.java | 21 +- .../rest/filter/RestUpdateFilterAction.java | 21 +- .../RestDeleteTrainedModelAction.java | 13 +- .../inference/RestGetTrainedModelsAction.java | 15 +- .../RestGetTrainedModelsStatsAction.java | 18 +- .../inference/RestPutTrainedModelAction.java | 16 +- .../xpack/ml/rest/job/RestCloseJobAction.java | 20 +- .../ml/rest/job/RestDeleteForecastAction.java | 29 +- .../ml/rest/job/RestDeleteJobAction.java | 20 +- .../xpack/ml/rest/job/RestFlushJobAction.java | 21 +- .../ml/rest/job/RestForecastJobAction.java | 21 +- .../ml/rest/job/RestGetJobStatsAction.java | 27 +- .../xpack/ml/rest/job/RestGetJobsAction.java | 27 +- .../xpack/ml/rest/job/RestOpenJobAction.java | 23 +- .../xpack/ml/rest/job/RestPostDataAction.java | 21 +- .../ml/rest/job/RestPostJobUpdateAction.java | 21 +- .../xpack/ml/rest/job/RestPutJobAction.java | 21 +- .../RestDeleteModelSnapshotAction.java | 27 +- .../RestGetModelSnapshotsAction.java | 59 ++-- .../RestRevertModelSnapshotAction.java | 25 +- .../RestUpdateModelSnapshotAction.java | 25 +- .../ml/rest/results/RestGetBucketsAction.java | 57 ++-- .../rest/results/RestGetCategoriesAction.java | 53 ++-- .../results/RestGetInfluencersAction.java | 35 ++- .../results/RestGetOverallBucketsAction.java | 34 ++- .../ml/rest/results/RestGetRecordsAction.java | 36 ++- .../validate/RestValidateDetectorAction.java | 20 +- .../validate/RestValidateJobConfigAction.java | 20 +- .../RestStartDatafeedActionTests.java | 4 +- .../xpack/monitoring/Monitoring.java | 2 +- .../rest/action/RestMonitoringBulkAction.java | 31 +-- .../action/RestMonitoringBulkActionTests.java | 5 +- .../elasticsearch/xpack/rollup/Rollup.java | 16 +- .../rest/RestDeleteRollupJobAction.java | 12 +- .../rollup/rest/RestGetRollupCapsAction.java | 12 +- .../rest/RestGetRollupIndexCapsAction.java | 12 +- .../rollup/rest/RestGetRollupJobsAction.java | 12 +- .../rollup/rest/RestPutRollupJobAction.java | 11 +- .../rollup/rest/RestRollupSearchAction.java | 22 +- .../rollup/rest/RestStartRollupJobAction.java | 12 +- .../rollup/rest/RestStopRollupJobAction.java | 12 +- .../xpack/security/Security.java | 68 ++--- .../security/rest/SecurityRestFilter.java | 17 ++ .../rest/action/RestAuthenticateAction.java | 22 +- .../RestDelegatePkiAuthenticationAction.java | 22 +- .../action/apikey/RestCreateApiKeyAction.java | 19 +- .../action/apikey/RestGetApiKeyAction.java | 16 +- .../apikey/RestInvalidateApiKeyAction.java | 16 +- .../action/oauth2/RestGetTokenAction.java | 23 +- .../oauth2/RestInvalidateTokenAction.java | 22 +- .../RestOpenIdConnectAuthenticateAction.java | 14 +- .../oidc/RestOpenIdConnectLogoutAction.java | 14 +- ...nIdConnectPrepareAuthenticationAction.java | 14 +- .../privilege/RestDeletePrivilegesAction.java | 20 +- .../RestGetBuiltinPrivilegesAction.java | 15 +- .../privilege/RestGetPrivilegesAction.java | 30 ++- .../privilege/RestPutPrivilegesAction.java | 24 +- .../realm/RestClearRealmCacheAction.java | 24 +- .../role/RestClearRolesCacheAction.java | 22 +- .../action/role/RestDeleteRoleAction.java | 21 +- .../rest/action/role/RestGetRolesAction.java | 27 +- .../rest/action/role/RestPutRoleAction.java | 27 +- .../RestDeleteRoleMappingAction.java | 22 +- .../RestGetRoleMappingsAction.java | 27 +- .../rolemapping/RestPutRoleMappingAction.java | 27 +- .../saml/RestSamlAuthenticateAction.java | 26 +- .../saml/RestSamlInvalidateSessionAction.java | 27 +- .../action/saml/RestSamlLogoutAction.java | 27 +- .../RestSamlPrepareAuthenticationAction.java | 27 +- .../action/user/RestChangePasswordAction.java | 39 +-- .../action/user/RestDeleteUserAction.java | 22 +- .../user/RestGetUserPrivilegesAction.java | 22 +- .../rest/action/user/RestGetUsersAction.java | 27 +- .../action/user/RestHasPrivilegesAction.java | 40 +-- .../rest/action/user/RestPutUserAction.java | 28 +- .../action/user/RestSetEnabledAction.java | 40 ++- .../action/SecurityBaseRestHandlerTests.java | 9 + .../apikey/RestCreateApiKeyActionTests.java | 7 +- .../apikey/RestGetApiKeyActionTests.java | 6 +- .../RestInvalidateApiKeyActionTests.java | 8 +- .../action/saml/SamlBaseRestHandlerTests.java | 10 + .../RestGetUserPrivilegesActionTests.java | 5 +- .../user/RestHasPrivilegesActionTests.java | 7 +- .../sql/plugin/RestSqlClearCursorAction.java | 11 +- .../xpack/sql/plugin/RestSqlQueryAction.java | 13 +- .../xpack/sql/plugin/RestSqlStatsAction.java | 12 +- .../sql/plugin/RestSqlTranslateAction.java | 13 +- .../xpack/sql/plugin/SqlPlugin.java | 8 +- .../xpack/transform/Transform.java | 32 +-- .../action/RestDeleteTransformAction.java | 14 +- .../rest/action/RestGetTransformAction.java | 18 +- .../action/RestGetTransformStatsAction.java | 18 +- .../action/RestPreviewTransformAction.java | 13 +- .../rest/action/RestPutTransformAction.java | 13 +- .../rest/action/RestStartTransformAction.java | 14 +- .../rest/action/RestStopTransformAction.java | 14 +- .../action/RestUpdateTransformAction.java | 13 +- .../RestDeleteTransformActionDeprecated.java | 21 +- .../RestGetTransformActionDeprecated.java | 27 +- ...RestGetTransformStatsActionDeprecated.java | 28 +- .../RestPreviewTransformActionDeprecated.java | 20 +- .../RestPutTransformActionDeprecated.java | 20 +- .../RestStartTransformActionDeprecated.java | 22 +- .../RestStopTransformActionDeprecated.java | 21 +- .../RestUpdateTransformActionDeprecated.java | 21 +- .../RestDeleteTransformActionTests.java | 4 +- .../elasticsearch/xpack/watcher/Watcher.java | 19 +- .../rest/action/RestAckWatchAction.java | 20 +- .../rest/action/RestActivateWatchAction.java | 24 +- .../rest/action/RestDeleteWatchAction.java | 12 +- .../rest/action/RestExecuteWatchAction.java | 20 +- .../rest/action/RestGetWatchAction.java | 12 +- .../rest/action/RestPutWatchAction.java | 13 +- .../rest/action/RestWatchServiceAction.java | 19 +- .../rest/action/RestWatcherStatsAction.java | 15 +- 371 files changed, 4769 insertions(+), 2042 deletions(-) diff --git a/client/client-benchmark-noop-api-plugin/src/main/java/org/elasticsearch/plugin/noop/NoopPlugin.java b/client/client-benchmark-noop-api-plugin/src/main/java/org/elasticsearch/plugin/noop/NoopPlugin.java index 0eceed67c4f73..2013b0d6680a8 100644 --- a/client/client-benchmark-noop-api-plugin/src/main/java/org/elasticsearch/plugin/noop/NoopPlugin.java +++ b/client/client-benchmark-noop-api-plugin/src/main/java/org/elasticsearch/plugin/noop/NoopPlugin.java @@ -55,7 +55,7 @@ public List getRestHandlers(Settings settings, RestController restC IndexScopedSettings indexScopedSettings, SettingsFilter settingsFilter, IndexNameExpressionResolver indexNameExpressionResolver, Supplier nodesInCluster) { return Arrays.asList( - new RestNoopBulkAction(restController), - new RestNoopSearchAction(restController)); + new RestNoopBulkAction(), + new RestNoopSearchAction()); } } diff --git a/client/client-benchmark-noop-api-plugin/src/main/java/org/elasticsearch/plugin/noop/action/bulk/RestNoopBulkAction.java b/client/client-benchmark-noop-api-plugin/src/main/java/org/elasticsearch/plugin/noop/action/bulk/RestNoopBulkAction.java index ffc94a3507853..d6c0ef736e344 100644 --- a/client/client-benchmark-noop-api-plugin/src/main/java/org/elasticsearch/plugin/noop/action/bulk/RestNoopBulkAction.java +++ b/client/client-benchmark-noop-api-plugin/src/main/java/org/elasticsearch/plugin/noop/action/bulk/RestNoopBulkAction.java @@ -27,29 +27,36 @@ import org.elasticsearch.action.update.UpdateResponse; import org.elasticsearch.client.Requests; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.index.shard.ShardId; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestChannel; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestBuilderListener; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.RestRequest.Method.PUT; import static org.elasticsearch.rest.RestStatus.OK; public class RestNoopBulkAction extends BaseRestHandler { - public RestNoopBulkAction(RestController controller) { - controller.registerHandler(POST, "/_noop_bulk", this); - controller.registerHandler(PUT, "/_noop_bulk", this); - controller.registerHandler(POST, "/{index}/_noop_bulk", this); - controller.registerHandler(PUT, "/{index}/_noop_bulk", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_noop_bulk", unmodifiableList(asList(POST, PUT))) + .put("/{index}/_noop_bulk", unmodifiableList(asList(POST, PUT))) + .map()); } @Override diff --git a/client/client-benchmark-noop-api-plugin/src/main/java/org/elasticsearch/plugin/noop/action/search/RestNoopSearchAction.java b/client/client-benchmark-noop-api-plugin/src/main/java/org/elasticsearch/plugin/noop/action/search/RestNoopSearchAction.java index 5271380bdfc16..1ea392434e6f2 100644 --- a/client/client-benchmark-noop-api-plugin/src/main/java/org/elasticsearch/plugin/noop/action/search/RestNoopSearchAction.java +++ b/client/client-benchmark-noop-api-plugin/src/main/java/org/elasticsearch/plugin/noop/action/search/RestNoopSearchAction.java @@ -20,21 +20,29 @@ import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestStatusToXContentListener; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestNoopSearchAction extends BaseRestHandler { - public RestNoopSearchAction(RestController controller) { - controller.registerHandler(GET, "/_noop_search", this); - controller.registerHandler(POST, "/_noop_search", this); - controller.registerHandler(GET, "/{index}/_noop_search", this); - controller.registerHandler(POST, "/{index}/_noop_search", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_noop_search", unmodifiableList(asList(GET, POST))) + .put("/{index}/_noop_search", unmodifiableList(asList(GET, POST))) + .map()); } @Override diff --git a/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/GrokProcessorGetAction.java b/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/GrokProcessorGetAction.java index 35a4c76dd4a17..534eac6a50974 100644 --- a/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/GrokProcessorGetAction.java +++ b/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/GrokProcessorGetAction.java @@ -32,15 +32,18 @@ import org.elasticsearch.common.xcontent.ToXContentObject; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.tasks.Task; import org.elasticsearch.transport.TransportService; import java.io.IOException; +import java.util.List; import java.util.Map; +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.elasticsearch.ingest.common.IngestCommonPlugin.GROK_PATTERNS; import static org.elasticsearch.rest.RestRequest.Method.GET; @@ -116,8 +119,10 @@ protected void doExecute(Task task, Request request, ActionListener li } public static class RestAction extends BaseRestHandler { - RestAction(RestController controller) { - controller.registerHandler(GET, "/_ingest/processor/grok", this); + + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_ingest/processor/grok", singletonList(GET)); } @Override diff --git a/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/IngestCommonPlugin.java b/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/IngestCommonPlugin.java index b37e5d13e4602..d4293c50e14a0 100644 --- a/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/IngestCommonPlugin.java +++ b/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/IngestCommonPlugin.java @@ -103,7 +103,7 @@ public List getRestHandlers(Settings settings, RestController restC IndexScopedSettings indexScopedSettings, SettingsFilter settingsFilter, IndexNameExpressionResolver indexNameExpressionResolver, Supplier nodesInCluster) { - return Arrays.asList(new GrokProcessorGetAction.RestAction(restController)); + return Collections.singletonList(new GrokProcessorGetAction.RestAction()); } @Override diff --git a/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/MustachePlugin.java b/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/MustachePlugin.java index 42c140cada0a3..edbff8eb8b799 100644 --- a/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/MustachePlugin.java +++ b/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/MustachePlugin.java @@ -59,8 +59,8 @@ public List getRestHandlers(Settings settings, RestController restC IndexScopedSettings indexScopedSettings, SettingsFilter settingsFilter, IndexNameExpressionResolver indexNameExpressionResolver, Supplier nodesInCluster) { return Arrays.asList( - new RestSearchTemplateAction(restController), - new RestMultiSearchTemplateAction(settings, restController), - new RestRenderSearchTemplateAction(restController)); + new RestSearchTemplateAction(), + new RestMultiSearchTemplateAction(settings), + new RestRenderSearchTemplateAction()); } } diff --git a/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestMultiSearchTemplateAction.java b/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestMultiSearchTemplateAction.java index c6baa257a7869..37413b0314dad 100644 --- a/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestMultiSearchTemplateAction.java +++ b/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestMultiSearchTemplateAction.java @@ -20,20 +20,24 @@ package org.elasticsearch.script.mustache; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.rest.action.search.RestMultiSearchAction; import org.elasticsearch.rest.action.search.RestSearchAction; import java.io.IOException; -import java.util.Arrays; import java.util.Collections; import java.util.HashSet; +import java.util.List; +import java.util.Map; import java.util.Set; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -43,7 +47,7 @@ public class RestMultiSearchTemplateAction extends BaseRestHandler { static { final Set responseParams = new HashSet<>( - Arrays.asList(RestSearchAction.TYPED_KEYS_PARAM, RestSearchAction.TOTAL_HITS_AS_INT_PARAM) + asList(RestSearchAction.TYPED_KEYS_PARAM, RestSearchAction.TOTAL_HITS_AS_INT_PARAM) ); RESPONSE_PARAMS = Collections.unmodifiableSet(responseParams); } @@ -51,13 +55,16 @@ public class RestMultiSearchTemplateAction extends BaseRestHandler { private final boolean allowExplicitIndex; - public RestMultiSearchTemplateAction(Settings settings, RestController controller) { + public RestMultiSearchTemplateAction(Settings settings) { this.allowExplicitIndex = MULTI_ALLOW_EXPLICIT_INDEX.get(settings); + } - controller.registerHandler(GET, "/_msearch/template", this); - controller.registerHandler(POST, "/_msearch/template", this); - controller.registerHandler(GET, "/{index}/_msearch/template", this); - controller.registerHandler(POST, "/{index}/_msearch/template", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_msearch/template", unmodifiableList(asList(GET, POST))) + .put("/{index}/_msearch/template", unmodifiableList(asList(GET, POST))) + .map()); } @Override diff --git a/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestRenderSearchTemplateAction.java b/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestRenderSearchTemplateAction.java index 767f6e95c1f78..5327d0dc125a7 100644 --- a/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestRenderSearchTemplateAction.java +++ b/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestRenderSearchTemplateAction.java @@ -20,25 +20,32 @@ package org.elasticsearch.script.mustache; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.script.ScriptType; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestRenderSearchTemplateAction extends BaseRestHandler { - public RestRenderSearchTemplateAction(RestController controller) { - controller.registerHandler(GET, "/_render/template", this); - controller.registerHandler(POST, "/_render/template", this); - controller.registerHandler(GET, "/_render/template/{id}", this); - controller.registerHandler(POST, "/_render/template/{id}", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_render/template", unmodifiableList(asList(GET, POST))) + .put("/_render/template/{id}", unmodifiableList(asList(GET, POST))) + .map()); } @Override diff --git a/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestSearchTemplateAction.java b/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestSearchTemplateAction.java index 4ce457c1a22e5..aaa9cedddf3cf 100644 --- a/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestSearchTemplateAction.java +++ b/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestSearchTemplateAction.java @@ -21,10 +21,11 @@ import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestStatusToXContentListener; import org.elasticsearch.rest.action.search.RestSearchAction; @@ -32,8 +33,12 @@ import java.util.Arrays; import java.util.Collections; import java.util.HashSet; +import java.util.List; +import java.util.Map; import java.util.Set; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -46,11 +51,12 @@ public class RestSearchTemplateAction extends BaseRestHandler { RESPONSE_PARAMS = Collections.unmodifiableSet(responseParams); } - public RestSearchTemplateAction(RestController controller) { - controller.registerHandler(GET, "/_search/template", this); - controller.registerHandler(POST, "/_search/template", this); - controller.registerHandler(GET, "/{index}/_search/template", this); - controller.registerHandler(POST, "/{index}/_search/template", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_search/template", unmodifiableList(asList(GET, POST))) + .put("/{index}/_search/template", unmodifiableList(asList(GET, POST))) + .map()); } @Override diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/PainlessPlugin.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/PainlessPlugin.java index 974cdefd529be..f65b3c2aa79a1 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/PainlessPlugin.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/PainlessPlugin.java @@ -155,8 +155,8 @@ public List getRestHandlers(Settings settings, RestController restC IndexNameExpressionResolver indexNameExpressionResolver, Supplier nodesInCluster) { List handlers = new ArrayList<>(); - handlers.add(new PainlessExecuteAction.RestAction(restController)); - handlers.add(new PainlessContextAction.RestAction(restController)); + handlers.add(new PainlessExecuteAction.RestAction()); + handlers.add(new PainlessContextAction.RestAction()); return handlers; } } diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/action/PainlessContextAction.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/action/PainlessContextAction.java index 9075b9e030df8..1d35eb608056c 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/action/PainlessContextAction.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/action/PainlessContextAction.java @@ -37,8 +37,8 @@ import org.elasticsearch.painless.PainlessScriptEngine; import org.elasticsearch.painless.lookup.PainlessLookup; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.script.ScriptContext; import org.elasticsearch.tasks.Task; @@ -52,6 +52,8 @@ import java.util.Objects; import java.util.stream.Collectors; +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; /** @@ -194,8 +196,9 @@ protected void doExecute(Task task, Request request, ActionListener li public static class RestAction extends BaseRestHandler { - public RestAction(RestController controller) { - controller.registerHandler(GET, "/_scripts/painless/_context", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_scripts/painless/_context", singletonList(GET)); } @Override diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/action/PainlessExecuteAction.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/action/PainlessExecuteAction.java index b6bb1a842640d..7ecce92a6d3a2 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/action/PainlessExecuteAction.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/action/PainlessExecuteAction.java @@ -68,8 +68,8 @@ import org.elasticsearch.index.shard.ShardId; import org.elasticsearch.indices.IndicesService; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.script.FilterScript; import org.elasticsearch.script.ScoreScript; @@ -81,9 +81,13 @@ import org.elasticsearch.transport.TransportService; import java.io.IOException; +import java.util.List; import java.util.Map; import java.util.Objects; +import static java.util.Arrays.asList; +import static java.util.Collections.singletonMap; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.action.ValidateActions.addValidationError; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -564,9 +568,9 @@ private static Response prepareRamIndex(Request request, public static class RestAction extends BaseRestHandler { - public RestAction(RestController controller) { - controller.registerHandler(GET, "/_scripts/painless/_execute", this); - controller.registerHandler(POST, "/_scripts/painless/_execute", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_scripts/painless/_execute", unmodifiableList(asList(GET, POST))); } @Override diff --git a/modules/rank-eval/src/main/java/org/elasticsearch/index/rankeval/RankEvalPlugin.java b/modules/rank-eval/src/main/java/org/elasticsearch/index/rankeval/RankEvalPlugin.java index 48b4297378108..9f21a6065900e 100644 --- a/modules/rank-eval/src/main/java/org/elasticsearch/index/rankeval/RankEvalPlugin.java +++ b/modules/rank-eval/src/main/java/org/elasticsearch/index/rankeval/RankEvalPlugin.java @@ -36,6 +36,7 @@ import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.List; import java.util.function.Supplier; @@ -50,7 +51,7 @@ public class RankEvalPlugin extends Plugin implements ActionPlugin { public List getRestHandlers(Settings settings, RestController restController, ClusterSettings clusterSettings, IndexScopedSettings indexScopedSettings, SettingsFilter settingsFilter, IndexNameExpressionResolver indexNameExpressionResolver, Supplier nodesInCluster) { - return Arrays.asList(new RestRankEvalAction(restController)); + return Collections.singletonList(new RestRankEvalAction()); } @Override diff --git a/modules/rank-eval/src/main/java/org/elasticsearch/index/rankeval/RestRankEvalAction.java b/modules/rank-eval/src/main/java/org/elasticsearch/index/rankeval/RestRankEvalAction.java index 85e9e656808e8..773bbef1cef53 100644 --- a/modules/rank-eval/src/main/java/org/elasticsearch/index/rankeval/RestRankEvalAction.java +++ b/modules/rank-eval/src/main/java/org/elasticsearch/index/rankeval/RestRankEvalAction.java @@ -23,14 +23,20 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -90,11 +96,12 @@ public class RestRankEvalAction extends BaseRestHandler { public static String ENDPOINT = "_rank_eval"; - public RestRankEvalAction(RestController controller) { - controller.registerHandler(GET, "/" + ENDPOINT, this); - controller.registerHandler(POST, "/" + ENDPOINT, this); - controller.registerHandler(GET, "/{index}/" + ENDPOINT, this); - controller.registerHandler(POST, "/{index}/" + ENDPOINT, this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/" + ENDPOINT, unmodifiableList(asList(GET, POST))) + .put("/{index}/" + ENDPOINT, unmodifiableList(asList(GET, POST))) + .map()); } @Override diff --git a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/ReindexPlugin.java b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/ReindexPlugin.java index fefee4f348b3e..c0e6a55ec9c13 100644 --- a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/ReindexPlugin.java +++ b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/ReindexPlugin.java @@ -74,10 +74,10 @@ public List getRestHandlers(Settings settings, RestController restC IndexScopedSettings indexScopedSettings, SettingsFilter settingsFilter, IndexNameExpressionResolver indexNameExpressionResolver, Supplier nodesInCluster) { return Arrays.asList( - new RestReindexAction(restController), - new RestUpdateByQueryAction(restController), - new RestDeleteByQueryAction(restController), - new RestRethrottleAction(restController, nodesInCluster)); + new RestReindexAction(), + new RestUpdateByQueryAction(), + new RestDeleteByQueryAction(), + new RestRethrottleAction(nodesInCluster)); } @Override diff --git a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestDeleteByQueryAction.java b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestDeleteByQueryAction.java index 95fab3dd44db3..3cb0f08aeac1b 100644 --- a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestDeleteByQueryAction.java +++ b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestDeleteByQueryAction.java @@ -20,21 +20,28 @@ package org.elasticsearch.index.reindex; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import java.io.IOException; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.function.Consumer; +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestDeleteByQueryAction extends AbstractBulkByQueryRestHandler { - public RestDeleteByQueryAction(RestController controller) { + public RestDeleteByQueryAction() { super(DeleteByQueryAction.INSTANCE); - controller.registerHandler(POST, "/{index}/_delete_by_query", this); + } + + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/{index}/_delete_by_query", singletonList(POST)); } @Override diff --git a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestReindexAction.java b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestReindexAction.java index 516d47b835803..808f4844b3177 100644 --- a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestReindexAction.java +++ b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestReindexAction.java @@ -21,11 +21,15 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import java.io.IOException; +import java.util.List; +import java.util.Map; +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.elasticsearch.common.unit.TimeValue.parseTimeValue; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -34,9 +38,13 @@ */ public class RestReindexAction extends AbstractBaseReindexRestHandler { - public RestReindexAction(RestController controller) { + public RestReindexAction() { super(ReindexAction.INSTANCE); - controller.registerHandler(POST, "/_reindex", this); + } + + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_reindex", singletonList(POST)); } @Override diff --git a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestRethrottleAction.java b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestRethrottleAction.java index cdd29a89b92c8..78143d6ad2cd9 100644 --- a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestRethrottleAction.java +++ b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestRethrottleAction.java @@ -21,24 +21,35 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.cluster.node.DiscoveryNodes; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.tasks.TaskId; +import java.util.Collections; +import java.util.List; +import java.util.Map; import java.util.function.Supplier; +import static java.util.Collections.singletonList; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.action.admin.cluster.RestListTasksAction.listTasksResponseListener; public class RestRethrottleAction extends BaseRestHandler { private final Supplier nodesInCluster; - public RestRethrottleAction(RestController controller, Supplier nodesInCluster) { + public RestRethrottleAction(Supplier nodesInCluster) { this.nodesInCluster = nodesInCluster; - controller.registerHandler(POST, "/_update_by_query/{taskId}/_rethrottle", this); - controller.registerHandler(POST, "/_delete_by_query/{taskId}/_rethrottle", this); - controller.registerHandler(POST, "/_reindex/{taskId}/_rethrottle", this); + } + + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_update_by_query/{taskId}/_rethrottle", singletonList(POST)) + .put("/_delete_by_query/{taskId}/_rethrottle", singletonList(POST)) + .put("/_reindex/{taskId}/_rethrottle", singletonList(POST)) + .map()); } @Override diff --git a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestUpdateByQueryAction.java b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestUpdateByQueryAction.java index 5927aca9bb1e1..47799b036da0d 100644 --- a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestUpdateByQueryAction.java +++ b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestUpdateByQueryAction.java @@ -22,8 +22,8 @@ import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.xcontent.LoggingDeprecationHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.script.Script; import org.elasticsearch.script.ScriptType; @@ -31,16 +31,24 @@ import java.util.Collections; import java.util.HashMap; import java.util.Iterator; +import java.util.List; import java.util.Map; import java.util.function.Consumer; +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.script.Script.DEFAULT_SCRIPT_LANG; public class RestUpdateByQueryAction extends AbstractBulkByQueryRestHandler { - public RestUpdateByQueryAction(RestController controller) { + + public RestUpdateByQueryAction() { super(UpdateByQueryAction.INSTANCE); - controller.registerHandler(POST, "/{index}/_update_by_query", this); + } + + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/{index}/_update_by_query", singletonList(POST)); } @Override diff --git a/modules/reindex/src/test/java/org/elasticsearch/index/reindex/RestReindexActionTests.java b/modules/reindex/src/test/java/org/elasticsearch/index/reindex/RestReindexActionTests.java index ebfc117ec04ec..cb8217b78ef35 100644 --- a/modules/reindex/src/test/java/org/elasticsearch/index/reindex/RestReindexActionTests.java +++ b/modules/reindex/src/test/java/org/elasticsearch/index/reindex/RestReindexActionTests.java @@ -38,7 +38,8 @@ public class RestReindexActionTests extends RestActionTestCase { @Before public void setUpAction() { - action = new RestReindexAction(controller()); + action = new RestReindexAction(); + controller().registerHandler(action); } public void testPipelineQueryParameterIsError() throws IOException { diff --git a/plugins/examples/rest-handler/src/main/java/org/elasticsearch/example/resthandler/ExampleCatAction.java b/plugins/examples/rest-handler/src/main/java/org/elasticsearch/example/resthandler/ExampleCatAction.java index 79cb1a6f76ded..f5cb99839b51b 100644 --- a/plugins/examples/rest-handler/src/main/java/org/elasticsearch/example/resthandler/ExampleCatAction.java +++ b/plugins/examples/rest-handler/src/main/java/org/elasticsearch/example/resthandler/ExampleCatAction.java @@ -21,11 +21,17 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Table; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.cat.AbstractCatAction; import org.elasticsearch.rest.action.cat.RestTable; +import java.util.List; +import java.util.Map; + +import static java.util.Arrays.asList; +import static java.util.Collections.singletonMap; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -34,9 +40,9 @@ */ public class ExampleCatAction extends AbstractCatAction { - ExampleCatAction(final RestController controller) { - controller.registerHandler(GET, "/_cat/example", this); - controller.registerHandler(POST, "/_cat/example", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_cat/example", unmodifiableList(asList(GET, POST))); } @Override diff --git a/plugins/examples/rest-handler/src/main/java/org/elasticsearch/example/resthandler/ExampleRestHandlerPlugin.java b/plugins/examples/rest-handler/src/main/java/org/elasticsearch/example/resthandler/ExampleRestHandlerPlugin.java index 725049c797e15..420a58302f35c 100644 --- a/plugins/examples/rest-handler/src/main/java/org/elasticsearch/example/resthandler/ExampleRestHandlerPlugin.java +++ b/plugins/examples/rest-handler/src/main/java/org/elasticsearch/example/resthandler/ExampleRestHandlerPlugin.java @@ -46,6 +46,6 @@ public List getRestHandlers(final Settings settings, final IndexNameExpressionResolver indexNameExpressionResolver, final Supplier nodesInCluster) { - return singletonList(new ExampleCatAction(restController)); + return singletonList(new ExampleCatAction()); } } diff --git a/qa/die-with-dignity/src/main/java/org/elasticsearch/DieWithDignityPlugin.java b/qa/die-with-dignity/src/main/java/org/elasticsearch/DieWithDignityPlugin.java index 8b7093515cd71..29c81c1a39c0a 100644 --- a/qa/die-with-dignity/src/main/java/org/elasticsearch/DieWithDignityPlugin.java +++ b/qa/die-with-dignity/src/main/java/org/elasticsearch/DieWithDignityPlugin.java @@ -49,7 +49,7 @@ public List getRestHandlers( final SettingsFilter settingsFilter, final IndexNameExpressionResolver indexNameExpressionResolver, final Supplier nodesInCluster) { - return Collections.singletonList(new RestDieWithDignityAction(restController)); + return Collections.singletonList(new RestDieWithDignityAction()); } } diff --git a/qa/die-with-dignity/src/main/java/org/elasticsearch/RestDieWithDignityAction.java b/qa/die-with-dignity/src/main/java/org/elasticsearch/RestDieWithDignityAction.java index 8f43d67908432..04b800265be7c 100644 --- a/qa/die-with-dignity/src/main/java/org/elasticsearch/RestDieWithDignityAction.java +++ b/qa/die-with-dignity/src/main/java/org/elasticsearch/RestDieWithDignityAction.java @@ -21,13 +21,23 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; + +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestDieWithDignityAction extends BaseRestHandler { - RestDieWithDignityAction(final RestController restController) { - restController.registerHandler(RestRequest.Method.GET, "/_die_with_dignity", this); + RestDieWithDignityAction() {} + + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_die_with_dignity", singletonList(GET)); } @Override diff --git a/qa/smoke-test-http/src/test/java/org/elasticsearch/http/TestDeprecationHeaderRestAction.java b/qa/smoke-test-http/src/test/java/org/elasticsearch/http/TestDeprecationHeaderRestAction.java index a864bde42b281..55b1e398df032 100644 --- a/qa/smoke-test-http/src/test/java/org/elasticsearch/http/TestDeprecationHeaderRestAction.java +++ b/qa/smoke-test-http/src/test/java/org/elasticsearch/http/TestDeprecationHeaderRestAction.java @@ -28,14 +28,18 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestStatus; import java.io.IOException; +import java.util.Collections; import java.util.List; import java.util.Map; +import static java.util.Collections.singletonList; +import static org.elasticsearch.rest.RestRequest.Method.GET; + /** * Enables testing {@code DeprecationRestHandler} via integration tests by guaranteeing a deprecated REST endpoint. *

@@ -66,11 +70,14 @@ public class TestDeprecationHeaderRestAction extends BaseRestHandler { private final Settings settings; - public TestDeprecationHeaderRestAction(Settings settings, RestController controller) { + public TestDeprecationHeaderRestAction(Settings settings) { this.settings = settings; + } - controller.registerAsDeprecatedHandler(RestRequest.Method.GET, "/_test_cluster/deprecated_settings", this, - DEPRECATED_ENDPOINT, deprecationLogger); + @Override + public List deprecatedHandledMethodsAndPaths() { + return singletonList( + new DeprecatedRestApi("/_test_cluster/deprecated_settings", singletonList(GET), DEPRECATED_ENDPOINT, deprecationLogger)); } @Override @@ -78,6 +85,11 @@ public String getName() { return "test_deprecation_header_action"; } + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + @SuppressWarnings("unchecked") // List casts @Override public RestChannelConsumer prepareRequest(RestRequest request, NodeClient client) throws IOException { diff --git a/qa/smoke-test-http/src/test/java/org/elasticsearch/http/TestDeprecationPlugin.java b/qa/smoke-test-http/src/test/java/org/elasticsearch/http/TestDeprecationPlugin.java index a264227999eda..81faab8289301 100644 --- a/qa/smoke-test-http/src/test/java/org/elasticsearch/http/TestDeprecationPlugin.java +++ b/qa/smoke-test-http/src/test/java/org/elasticsearch/http/TestDeprecationPlugin.java @@ -47,7 +47,7 @@ public class TestDeprecationPlugin extends Plugin implements ActionPlugin, Searc public List getRestHandlers(Settings settings, RestController restController, ClusterSettings clusterSettings, IndexScopedSettings indexScopedSettings, SettingsFilter settingsFilter, IndexNameExpressionResolver indexNameExpressionResolver, Supplier nodesInCluster) { - return Collections.singletonList(new TestDeprecationHeaderRestAction(settings, restController)); + return Collections.singletonList(new TestDeprecationHeaderRestAction(settings)); } @Override diff --git a/qa/smoke-test-http/src/test/java/org/elasticsearch/http/TestResponseHeaderPlugin.java b/qa/smoke-test-http/src/test/java/org/elasticsearch/http/TestResponseHeaderPlugin.java index 0f9b6f4db19dd..a869276fdac1e 100644 --- a/qa/smoke-test-http/src/test/java/org/elasticsearch/http/TestResponseHeaderPlugin.java +++ b/qa/smoke-test-http/src/test/java/org/elasticsearch/http/TestResponseHeaderPlugin.java @@ -40,6 +40,6 @@ public class TestResponseHeaderPlugin extends Plugin implements ActionPlugin { public List getRestHandlers(Settings settings, RestController restController, ClusterSettings clusterSettings, IndexScopedSettings indexScopedSettings, SettingsFilter settingsFilter, IndexNameExpressionResolver indexNameExpressionResolver, Supplier nodesInCluster) { - return singletonList(new TestResponseHeaderRestAction(restController)); + return singletonList(new TestResponseHeaderRestAction()); } } diff --git a/qa/smoke-test-http/src/test/java/org/elasticsearch/http/TestResponseHeaderRestAction.java b/qa/smoke-test-http/src/test/java/org/elasticsearch/http/TestResponseHeaderRestAction.java index c51947f7328cb..73bc20181498a 100644 --- a/qa/smoke-test-http/src/test/java/org/elasticsearch/http/TestResponseHeaderRestAction.java +++ b/qa/smoke-test-http/src/test/java/org/elasticsearch/http/TestResponseHeaderRestAction.java @@ -21,15 +21,23 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.GET; + public class TestResponseHeaderRestAction extends BaseRestHandler { - public TestResponseHeaderRestAction(RestController controller) { - controller.registerHandler(RestRequest.Method.GET, "/_protected", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_protected", singletonList(GET)); } @Override diff --git a/server/src/main/java/org/elasticsearch/action/ActionModule.java b/server/src/main/java/org/elasticsearch/action/ActionModule.java index 064b28808dc32..62c265bc17a78 100644 --- a/server/src/main/java/org/elasticsearch/action/ActionModule.java +++ b/server/src/main/java/org/elasticsearch/action/ActionModule.java @@ -322,6 +322,8 @@ import org.elasticsearch.rest.action.document.RestGetAction; import org.elasticsearch.rest.action.document.RestGetSourceAction; import org.elasticsearch.rest.action.document.RestIndexAction; +import org.elasticsearch.rest.action.document.RestIndexAction.AutoIdHandler; +import org.elasticsearch.rest.action.document.RestIndexAction.CreateHandler; import org.elasticsearch.rest.action.document.RestMultiGetAction; import org.elasticsearch.rest.action.document.RestMultiTermVectorsAction; import org.elasticsearch.rest.action.document.RestTermVectorsAction; @@ -565,148 +567,151 @@ private ActionFilters setupActionFilters(List actionPlugins) { public void initRestHandlers(Supplier nodesInCluster) { List catActions = new ArrayList<>(); - Consumer registerHandler = a -> { - if (a instanceof AbstractCatAction) { - catActions.add((AbstractCatAction) a); + Consumer registerHandler = handler -> { + if (handler instanceof AbstractCatAction) { + catActions.add((AbstractCatAction) handler); } + restController.registerHandler(handler); }; - registerHandler.accept(new RestAddVotingConfigExclusionAction(restController)); - registerHandler.accept(new RestClearVotingConfigExclusionsAction(restController)); - registerHandler.accept(new RestMainAction(restController)); - registerHandler.accept(new RestNodesInfoAction(restController, settingsFilter)); - registerHandler.accept(new RestRemoteClusterInfoAction(restController)); - registerHandler.accept(new RestNodesStatsAction(restController)); - registerHandler.accept(new RestNodesUsageAction(restController)); - registerHandler.accept(new RestNodesHotThreadsAction(restController)); - registerHandler.accept(new RestClusterAllocationExplainAction(restController)); - registerHandler.accept(new RestClusterStatsAction(restController)); - registerHandler.accept(new RestClusterStateAction(restController, settingsFilter)); - registerHandler.accept(new RestClusterHealthAction(restController)); - registerHandler.accept(new RestClusterUpdateSettingsAction(restController)); - registerHandler.accept(new RestClusterGetSettingsAction(settings, restController, clusterSettings, settingsFilter)); - registerHandler.accept(new RestClusterRerouteAction(restController, settingsFilter)); - registerHandler.accept(new RestClusterSearchShardsAction(restController)); - registerHandler.accept(new RestPendingClusterTasksAction(restController)); - registerHandler.accept(new RestPutRepositoryAction(restController)); - registerHandler.accept(new RestGetRepositoriesAction(restController, settingsFilter)); - registerHandler.accept(new RestDeleteRepositoryAction(restController)); - registerHandler.accept(new RestVerifyRepositoryAction(restController)); - registerHandler.accept(new RestCleanupRepositoryAction(restController)); - registerHandler.accept(new RestGetSnapshotsAction(restController)); - registerHandler.accept(new RestCreateSnapshotAction(restController)); - registerHandler.accept(new RestRestoreSnapshotAction(restController)); - registerHandler.accept(new RestDeleteSnapshotAction(restController)); - registerHandler.accept(new RestSnapshotsStatusAction(restController)); - registerHandler.accept(new RestGetIndicesAction(restController)); - registerHandler.accept(new RestIndicesStatsAction(restController)); - registerHandler.accept(new RestIndicesSegmentsAction(restController)); - registerHandler.accept(new RestIndicesShardStoresAction(restController)); - registerHandler.accept(new RestGetAliasesAction(restController)); - registerHandler.accept(new RestIndexDeleteAliasesAction(restController)); - registerHandler.accept(new RestIndexPutAliasAction(restController)); - registerHandler.accept(new RestIndicesAliasesAction(restController)); - registerHandler.accept(new RestCreateIndexAction(restController)); - registerHandler.accept(new RestResizeHandler.RestShrinkIndexAction(restController)); - registerHandler.accept(new RestResizeHandler.RestSplitIndexAction(restController)); - registerHandler.accept(new RestResizeHandler.RestCloneIndexAction(restController)); - registerHandler.accept(new RestRolloverIndexAction(restController)); - registerHandler.accept(new RestDeleteIndexAction(restController)); - registerHandler.accept(new RestCloseIndexAction(restController)); - registerHandler.accept(new RestOpenIndexAction(restController)); - - registerHandler.accept(new RestUpdateSettingsAction(restController)); - registerHandler.accept(new RestGetSettingsAction(restController)); - - registerHandler.accept(new RestAnalyzeAction(restController)); - registerHandler.accept(new RestGetIndexTemplateAction(restController)); - registerHandler.accept(new RestPutIndexTemplateAction(restController)); - registerHandler.accept(new RestDeleteIndexTemplateAction(restController)); - - registerHandler.accept(new RestPutMappingAction(restController)); - registerHandler.accept(new RestGetMappingAction(restController)); - registerHandler.accept(new RestGetFieldMappingAction(restController)); - - registerHandler.accept(new RestRefreshAction(restController)); - registerHandler.accept(new RestFlushAction(restController)); - registerHandler.accept(new RestSyncedFlushAction(restController)); - registerHandler.accept(new RestForceMergeAction(restController)); - registerHandler.accept(new RestUpgradeActionDeprecated(restController)); - registerHandler.accept(new RestUpgradeStatusActionDeprecated(restController)); - registerHandler.accept(new RestClearIndicesCacheAction(restController)); - - registerHandler.accept(new RestIndexAction(restController, clusterService)); - registerHandler.accept(new RestGetAction(restController)); - registerHandler.accept(new RestGetSourceAction(restController)); - registerHandler.accept(new RestMultiGetAction(settings, restController)); - registerHandler.accept(new RestDeleteAction(restController)); - registerHandler.accept(new RestCountAction(restController)); - registerHandler.accept(new RestTermVectorsAction(restController)); - registerHandler.accept(new RestMultiTermVectorsAction(restController)); - registerHandler.accept(new RestBulkAction(settings, restController)); - registerHandler.accept(new RestUpdateAction(restController)); - - registerHandler.accept(new RestSearchAction(restController)); - registerHandler.accept(new RestSearchScrollAction(restController)); - registerHandler.accept(new RestClearScrollAction(restController)); - registerHandler.accept(new RestMultiSearchAction(settings, restController)); - - registerHandler.accept(new RestValidateQueryAction(restController)); - - registerHandler.accept(new RestExplainAction(restController)); - - registerHandler.accept(new RestRecoveryAction(restController)); - - registerHandler.accept(new RestReloadSecureSettingsAction(restController)); + registerHandler.accept(new RestAddVotingConfigExclusionAction()); + registerHandler.accept(new RestClearVotingConfigExclusionsAction()); + registerHandler.accept(new RestMainAction()); + registerHandler.accept(new RestNodesInfoAction(settingsFilter)); + registerHandler.accept(new RestRemoteClusterInfoAction()); + registerHandler.accept(new RestNodesStatsAction()); + registerHandler.accept(new RestNodesUsageAction()); + registerHandler.accept(new RestNodesHotThreadsAction()); + registerHandler.accept(new RestClusterAllocationExplainAction()); + registerHandler.accept(new RestClusterStatsAction()); + registerHandler.accept(new RestClusterStateAction(settingsFilter)); + registerHandler.accept(new RestClusterHealthAction()); + registerHandler.accept(new RestClusterUpdateSettingsAction()); + registerHandler.accept(new RestClusterGetSettingsAction(settings, clusterSettings, settingsFilter)); + registerHandler.accept(new RestClusterRerouteAction(settingsFilter)); + registerHandler.accept(new RestClusterSearchShardsAction()); + registerHandler.accept(new RestPendingClusterTasksAction()); + registerHandler.accept(new RestPutRepositoryAction()); + registerHandler.accept(new RestGetRepositoriesAction(settingsFilter)); + registerHandler.accept(new RestDeleteRepositoryAction()); + registerHandler.accept(new RestVerifyRepositoryAction()); + registerHandler.accept(new RestCleanupRepositoryAction()); + registerHandler.accept(new RestGetSnapshotsAction()); + registerHandler.accept(new RestCreateSnapshotAction()); + registerHandler.accept(new RestRestoreSnapshotAction()); + registerHandler.accept(new RestDeleteSnapshotAction()); + registerHandler.accept(new RestSnapshotsStatusAction()); + registerHandler.accept(new RestGetIndicesAction()); + registerHandler.accept(new RestIndicesStatsAction()); + registerHandler.accept(new RestIndicesSegmentsAction()); + registerHandler.accept(new RestIndicesShardStoresAction()); + registerHandler.accept(new RestGetAliasesAction()); + registerHandler.accept(new RestIndexDeleteAliasesAction()); + registerHandler.accept(new RestIndexPutAliasAction()); + registerHandler.accept(new RestIndicesAliasesAction()); + registerHandler.accept(new RestCreateIndexAction()); + registerHandler.accept(new RestResizeHandler.RestShrinkIndexAction()); + registerHandler.accept(new RestResizeHandler.RestSplitIndexAction()); + registerHandler.accept(new RestResizeHandler.RestCloneIndexAction()); + registerHandler.accept(new RestRolloverIndexAction()); + registerHandler.accept(new RestDeleteIndexAction()); + registerHandler.accept(new RestCloseIndexAction()); + registerHandler.accept(new RestOpenIndexAction()); + + registerHandler.accept(new RestUpdateSettingsAction()); + registerHandler.accept(new RestGetSettingsAction()); + + registerHandler.accept(new RestAnalyzeAction()); + registerHandler.accept(new RestGetIndexTemplateAction()); + registerHandler.accept(new RestPutIndexTemplateAction()); + registerHandler.accept(new RestDeleteIndexTemplateAction()); + + registerHandler.accept(new RestPutMappingAction()); + registerHandler.accept(new RestGetMappingAction()); + registerHandler.accept(new RestGetFieldMappingAction()); + + registerHandler.accept(new RestRefreshAction()); + registerHandler.accept(new RestFlushAction()); + registerHandler.accept(new RestSyncedFlushAction()); + registerHandler.accept(new RestForceMergeAction()); + registerHandler.accept(new RestUpgradeActionDeprecated()); + registerHandler.accept(new RestUpgradeStatusActionDeprecated()); + registerHandler.accept(new RestClearIndicesCacheAction()); + + registerHandler.accept(new RestIndexAction()); + registerHandler.accept(new CreateHandler()); + registerHandler.accept(new AutoIdHandler(clusterService)); + registerHandler.accept(new RestGetAction()); + registerHandler.accept(new RestGetSourceAction()); + registerHandler.accept(new RestMultiGetAction(settings)); + registerHandler.accept(new RestDeleteAction()); + registerHandler.accept(new RestCountAction()); + registerHandler.accept(new RestTermVectorsAction()); + registerHandler.accept(new RestMultiTermVectorsAction()); + registerHandler.accept(new RestBulkAction(settings)); + registerHandler.accept(new RestUpdateAction()); + + registerHandler.accept(new RestSearchAction()); + registerHandler.accept(new RestSearchScrollAction()); + registerHandler.accept(new RestClearScrollAction()); + registerHandler.accept(new RestMultiSearchAction(settings)); + + registerHandler.accept(new RestValidateQueryAction()); + + registerHandler.accept(new RestExplainAction()); + + registerHandler.accept(new RestRecoveryAction()); + + registerHandler.accept(new RestReloadSecureSettingsAction()); // Scripts API - registerHandler.accept(new RestGetStoredScriptAction(restController)); - registerHandler.accept(new RestPutStoredScriptAction(restController)); - registerHandler.accept(new RestDeleteStoredScriptAction(restController)); - registerHandler.accept(new RestGetScriptContextAction(restController)); - registerHandler.accept(new RestGetScriptLanguageAction(restController)); + registerHandler.accept(new RestGetStoredScriptAction()); + registerHandler.accept(new RestPutStoredScriptAction()); + registerHandler.accept(new RestDeleteStoredScriptAction()); + registerHandler.accept(new RestGetScriptContextAction()); + registerHandler.accept(new RestGetScriptLanguageAction()); - registerHandler.accept(new RestFieldCapabilitiesAction(restController)); + registerHandler.accept(new RestFieldCapabilitiesAction()); // Tasks API - registerHandler.accept(new RestListTasksAction(restController, nodesInCluster)); - registerHandler.accept(new RestGetTaskAction(restController)); - registerHandler.accept(new RestCancelTasksAction(restController, nodesInCluster)); + registerHandler.accept(new RestListTasksAction(nodesInCluster)); + registerHandler.accept(new RestGetTaskAction()); + registerHandler.accept(new RestCancelTasksAction(nodesInCluster)); // Ingest API - registerHandler.accept(new RestPutPipelineAction(restController)); - registerHandler.accept(new RestGetPipelineAction(restController)); - registerHandler.accept(new RestDeletePipelineAction(restController)); - registerHandler.accept(new RestSimulatePipelineAction(restController)); + registerHandler.accept(new RestPutPipelineAction()); + registerHandler.accept(new RestGetPipelineAction()); + registerHandler.accept(new RestDeletePipelineAction()); + registerHandler.accept(new RestSimulatePipelineAction()); // CAT API - registerHandler.accept(new RestAllocationAction(restController)); - registerHandler.accept(new RestShardsAction(restController)); - registerHandler.accept(new RestMasterAction(restController)); - registerHandler.accept(new RestNodesAction(restController)); - registerHandler.accept(new RestTasksAction(restController, nodesInCluster)); - registerHandler.accept(new RestIndicesAction(restController)); - registerHandler.accept(new RestSegmentsAction(restController)); + registerHandler.accept(new RestAllocationAction()); + registerHandler.accept(new RestShardsAction()); + registerHandler.accept(new RestMasterAction()); + registerHandler.accept(new RestNodesAction()); + registerHandler.accept(new RestTasksAction(nodesInCluster)); + registerHandler.accept(new RestIndicesAction()); + registerHandler.accept(new RestSegmentsAction()); // Fully qualified to prevent interference with rest.action.count.RestCountAction - registerHandler.accept(new org.elasticsearch.rest.action.cat.RestCountAction(restController)); + registerHandler.accept(new org.elasticsearch.rest.action.cat.RestCountAction()); // Fully qualified to prevent interference with rest.action.indices.RestRecoveryAction - registerHandler.accept(new RestCatRecoveryAction(restController)); - registerHandler.accept(new RestHealthAction(restController)); - registerHandler.accept(new org.elasticsearch.rest.action.cat.RestPendingClusterTasksAction(restController)); - registerHandler.accept(new RestAliasAction(restController)); - registerHandler.accept(new RestThreadPoolAction(restController)); - registerHandler.accept(new RestPluginsAction(restController)); - registerHandler.accept(new RestFielddataAction(restController)); - registerHandler.accept(new RestNodeAttrsAction(restController)); - registerHandler.accept(new RestRepositoriesAction(restController)); - registerHandler.accept(new RestSnapshotAction(restController)); - registerHandler.accept(new RestTemplatesAction(restController)); + registerHandler.accept(new RestCatRecoveryAction()); + registerHandler.accept(new RestHealthAction()); + registerHandler.accept(new org.elasticsearch.rest.action.cat.RestPendingClusterTasksAction()); + registerHandler.accept(new RestAliasAction()); + registerHandler.accept(new RestThreadPoolAction()); + registerHandler.accept(new RestPluginsAction()); + registerHandler.accept(new RestFielddataAction()); + registerHandler.accept(new RestNodeAttrsAction()); + registerHandler.accept(new RestRepositoriesAction()); + registerHandler.accept(new RestSnapshotAction()); + registerHandler.accept(new RestTemplatesAction()); for (ActionPlugin plugin : actionPlugins) { for (RestHandler handler : plugin.getRestHandlers(settings, restController, clusterSettings, indexScopedSettings, settingsFilter, indexNameExpressionResolver, nodesInCluster)) { registerHandler.accept(handler); } } - registerHandler.accept(new RestCatAction(restController, catActions)); + registerHandler.accept(new RestCatAction(catActions)); } @Override diff --git a/server/src/main/java/org/elasticsearch/common/collect/MapBuilder.java b/server/src/main/java/org/elasticsearch/common/collect/MapBuilder.java index abf27b662bb7c..5e18a9162f1d8 100644 --- a/server/src/main/java/org/elasticsearch/common/collect/MapBuilder.java +++ b/server/src/main/java/org/elasticsearch/common/collect/MapBuilder.java @@ -33,7 +33,7 @@ public static MapBuilder newMapBuilder(Map map) { return new MapBuilder<>(map); } - private Map map = new HashMap<>(); + private final Map map; public MapBuilder() { this.map = new HashMap<>(); diff --git a/server/src/main/java/org/elasticsearch/rest/BaseRestHandler.java b/server/src/main/java/org/elasticsearch/rest/BaseRestHandler.java index 5d33e55514629..26ba8aa27fb1a 100644 --- a/server/src/main/java/org/elasticsearch/rest/BaseRestHandler.java +++ b/server/src/main/java/org/elasticsearch/rest/BaseRestHandler.java @@ -18,6 +18,7 @@ */ package org.elasticsearch.rest; + import org.apache.lucene.search.spell.LevenshteinDistance; import org.apache.lucene.util.CollectionUtil; import org.elasticsearch.client.node.NodeClient; @@ -26,6 +27,7 @@ import org.elasticsearch.common.settings.Setting; import org.elasticsearch.common.settings.Setting.Property; import org.elasticsearch.plugins.ActionPlugin; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.admin.cluster.RestNodesUsageAction; import java.io.IOException; @@ -34,6 +36,7 @@ import java.util.HashSet; import java.util.List; import java.util.Locale; +import java.util.Map; import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; @@ -67,6 +70,12 @@ public final long getUsageCount() { */ public abstract String getName(); + /** + * {@inheritDoc} + */ + @Override + public abstract Map> handledMethodsAndPaths(); + @Override public final void handleRequest(RestRequest request, RestChannel channel, NodeClient client) throws Exception { // prepare the request for execution; has the side effect of touching the request parameters diff --git a/server/src/main/java/org/elasticsearch/rest/RestController.java b/server/src/main/java/org/elasticsearch/rest/RestController.java index aa39ccdc4659c..239f89c5c2028 100644 --- a/server/src/main/java/org/elasticsearch/rest/RestController.java +++ b/server/src/main/java/org/elasticsearch/rest/RestController.java @@ -96,7 +96,7 @@ public RestController(Set headersToCopy, UnaryOperatorDeprecated path to handle (e.g., "/_optimize") * @param logger The existing deprecation logger to use */ - public void registerWithDeprecatedHandler(RestRequest.Method method, String path, RestHandler handler, + protected void registerWithDeprecatedHandler(RestRequest.Method method, String path, RestHandler handler, RestRequest.Method deprecatedMethod, String deprecatedPath, DeprecationLogger logger) { // e.g., [POST /_optimize] is deprecated! Use [POST /_forcemerge] instead. @@ -146,7 +146,7 @@ public void registerWithDeprecatedHandler(RestRequest.Method method, String path * @param handler The handler to actually execute * @param method GET, POST, etc. */ - public void registerHandler(RestRequest.Method method, String path, RestHandler handler) { + protected void registerHandler(RestRequest.Method method, String path, RestHandler handler) { if (handler instanceof BaseRestHandler) { usageService.addRestHandler((BaseRestHandler) handler); } @@ -155,6 +155,19 @@ public void registerHandler(RestRequest.Method method, String path, RestHandler (mHandlers, newMHandler) -> mHandlers.addMethods(maybeWrappedHandler, method)); } + /** + * Registers a REST handler with the controller. The REST handler declares the {@code method} + * and {@code path} combinations. + */ + public void registerHandler(RestHandler restHandler) { + restHandler.handledMethodsAndPaths().forEach((path, methods) -> + methods.forEach(method -> registerHandler(method, path, restHandler))); + restHandler.deprecatedHandledMethodsAndPaths().forEach(api -> api.getMethods().forEach(method -> + registerAsDeprecatedHandler(method, api.getPath(), restHandler, api.getDeprecationMessage(), api.getLogger()))); + restHandler.replacedMethodsAndPaths().forEach(api -> registerWithDeprecatedHandler(api.getMethod(), api.getPath(), restHandler, + api.getDeprecatedMethod(), api.getDeprecatedPath(), api.getLogger())); + } + @Override public void dispatchRequest(RestRequest request, RestChannel channel, ThreadContext threadContext) { if (request.rawPath().equals("/favicon.ico")) { diff --git a/server/src/main/java/org/elasticsearch/rest/RestHandler.java b/server/src/main/java/org/elasticsearch/rest/RestHandler.java index 605dd41078a54..5f0862ed80e27 100644 --- a/server/src/main/java/org/elasticsearch/rest/RestHandler.java +++ b/server/src/main/java/org/elasticsearch/rest/RestHandler.java @@ -20,7 +20,13 @@ package org.elasticsearch.rest; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.xcontent.XContent; +import org.elasticsearch.rest.RestRequest.Method; + +import java.util.Collections; +import java.util.List; +import java.util.Map; /** * Handler for REST requests @@ -59,4 +65,104 @@ default boolean supportsContentStream() { default boolean allowsUnsafeBuffers() { return false; } + + /** + * The map of {@code path} to {@code methods} that this RestHandler is responsible for handling. + */ + default Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + /** + * A list of APIs handled by this RestHandler that are deprecated and do not have a direct + * replacement. If changing the {@code path} or {@code method} of the API, + * use {@link #replacedMethodsAndPaths()}. + */ + default List deprecatedHandledMethodsAndPaths() { + return Collections.emptyList(); + } + + /** + * A list of APIs handled by this RestHandler that have had their {@code path} and/or + * {@code method} changed. The pre-existing {@code path} and {@code method} will be registered + * as deprecated alongside the updated {@code path} and {@code method}. + */ + default List replacedMethodsAndPaths() { + return Collections.emptyList(); + } + + /** + * Represents an API that has been deprecated and is slated for removal. + */ + class DeprecatedRestApi { + + private final String path; + private final String deprecationMessage; + private final List methods; + private final DeprecationLogger logger; + + public DeprecatedRestApi(String path, List methods, String deprecationMessage, DeprecationLogger logger) { + this.path = path; + this.methods = methods; + this.deprecationMessage = deprecationMessage; + this.logger = logger; + } + + public String getPath() { + return path; + } + + public String getDeprecationMessage() { + return deprecationMessage; + } + + public List getMethods() { + return methods; + } + + public DeprecationLogger getLogger() { + return logger; + } + } + + /** + * Represents an API that has had its {@code path} or {@code method} changed. Holds both the + * new and previous {@code path} and {@code method} combination. + */ + class ReplacedRestApi { + + private final String path; + private final String deprecatedPath; + private final Method method; + private final Method deprecatedMethod; + private final DeprecationLogger logger; + + public ReplacedRestApi(Method method, String path, Method deprecatedMethod, String deprecatedPath, DeprecationLogger logger) { + this.method = method; + this.path = path; + this.deprecatedMethod = deprecatedMethod; + this.deprecatedPath = deprecatedPath; + this.logger = logger; + } + + public String getPath() { + return path; + } + + public String getDeprecatedPath() { + return deprecatedPath; + } + + public Method getMethod() { + return method; + } + + public Method getDeprecatedMethod() { + return deprecatedMethod; + } + + public DeprecationLogger getLogger() { + return logger; + } + } } diff --git a/server/src/main/java/org/elasticsearch/rest/action/RestFieldCapabilitiesAction.java b/server/src/main/java/org/elasticsearch/rest/action/RestFieldCapabilitiesAction.java index 613729f8904af..3b03b406c640e 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/RestFieldCapabilitiesAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/RestFieldCapabilitiesAction.java @@ -23,22 +23,29 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestFieldCapabilitiesAction extends BaseRestHandler { - public RestFieldCapabilitiesAction(RestController controller) { - controller.registerHandler(GET, "/_field_caps", this); - controller.registerHandler(POST, "/_field_caps", this); - controller.registerHandler(GET, "/{index}/_field_caps", this); - controller.registerHandler(POST, "/{index}/_field_caps", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_field_caps", unmodifiableList(asList(GET, POST))) + .put("/{index}/_field_caps", unmodifiableList(asList(GET, POST))) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/RestMainAction.java b/server/src/main/java/org/elasticsearch/rest/action/RestMainAction.java index e776a6ad08a7b..2dbdd895012d2 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/RestMainAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/RestMainAction.java @@ -26,20 +26,26 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import java.io.IOException; +import java.util.List; +import java.util.Map; +import static java.util.Arrays.asList; +import static java.util.Collections.singletonMap; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.HEAD; public class RestMainAction extends BaseRestHandler { - public RestMainAction(RestController controller) { - controller.registerHandler(GET, "/", this); - controller.registerHandler(HEAD, "/", this); + + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/", unmodifiableList(asList(GET, HEAD))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestAddVotingConfigExclusionAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestAddVotingConfigExclusionAction.java index 018392bb05ad8..7a78e5789a676 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestAddVotingConfigExclusionAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestAddVotingConfigExclusionAction.java @@ -23,27 +23,37 @@ import org.elasticsearch.action.admin.cluster.configuration.AddVotingConfigExclusionsRequest; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestAddVotingConfigExclusionAction extends BaseRestHandler { private static final TimeValue DEFAULT_TIMEOUT = TimeValue.timeValueSeconds(30L); - public RestAddVotingConfigExclusionAction(RestController controller) { - controller.registerHandler(RestRequest.Method.POST, "/_cluster/voting_config_exclusions/{node_name}", this); - } - @Override public String getName() { return "add_voting_config_exclusions_action"; } + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_cluster/voting_config_exclusions/{node_name}", singletonList(POST)) + .map()); + } + @Override protected RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException { AddVotingConfigExclusionsRequest votingConfigExclusionsRequest = resolveVotingConfigExclusionsRequest(request); diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCancelTasksAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCancelTasksAction.java index 2dd98bfb9a506..bce836c64a853 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCancelTasksAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCancelTasksAction.java @@ -23,14 +23,19 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.tasks.TaskId; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; import java.util.function.Supplier; +import static java.util.Collections.singletonList; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.action.admin.cluster.RestListTasksAction.listTasksResponseListener; @@ -38,10 +43,8 @@ public class RestCancelTasksAction extends BaseRestHandler { private final Supplier nodesInCluster; - public RestCancelTasksAction(RestController controller, Supplier nodesInCluster) { + public RestCancelTasksAction(Supplier nodesInCluster) { this.nodesInCluster = nodesInCluster; - controller.registerHandler(POST, "/_tasks/_cancel", this); - controller.registerHandler(POST, "/_tasks/{task_id}/_cancel", this); } @Override @@ -49,6 +52,14 @@ public String getName() { return "cancel_tasks_action"; } + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_tasks/_cancel", singletonList(POST)) + .put("/_tasks/{task_id}/_cancel", singletonList(POST)) + .map()); + } + @Override public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException { final String[] nodesIds = Strings.splitStringByCommaToArray(request.param("nodes")); diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCleanupRepositoryAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCleanupRepositoryAction.java index 3eca34ff2d3d5..5727b72fd84c5 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCleanupRepositoryAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCleanupRepositoryAction.java @@ -21,13 +21,18 @@ import org.elasticsearch.action.admin.cluster.repositories.cleanup.CleanupRepositoryRequest; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import static java.util.Collections.singletonList; import static org.elasticsearch.client.Requests.cleanupRepositoryRequest; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -36,8 +41,11 @@ */ public class RestCleanupRepositoryAction extends BaseRestHandler { - public RestCleanupRepositoryAction(RestController controller) { - controller.registerHandler(POST, "/_snapshot/{repository}/_cleanup", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_snapshot/{repository}/_cleanup", singletonList(POST)) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClearVotingConfigExclusionsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClearVotingConfigExclusionsAction.java index 8d9a2121b8149..332854559e718 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClearVotingConfigExclusionsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClearVotingConfigExclusionsAction.java @@ -22,17 +22,27 @@ import org.elasticsearch.action.admin.cluster.configuration.ClearVotingConfigExclusionsAction; import org.elasticsearch.action.admin.cluster.configuration.ClearVotingConfigExclusionsRequest; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static org.elasticsearch.rest.RestRequest.Method.DELETE; public class RestClearVotingConfigExclusionsAction extends BaseRestHandler { - public RestClearVotingConfigExclusionsAction(RestController controller) { - controller.registerHandler(RestRequest.Method.DELETE, "/_cluster/voting_config_exclusions", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_cluster/voting_config_exclusions", singletonList(DELETE)) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterAllocationExplainAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterAllocationExplainAction.java index 99d0f00d0967d..9ade44cd4a686 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterAllocationExplainAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterAllocationExplainAction.java @@ -22,27 +22,38 @@ import org.elasticsearch.action.admin.cluster.allocation.ClusterAllocationExplainRequest; import org.elasticsearch.action.admin.cluster.allocation.ClusterAllocationExplainResponse; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; +import static org.elasticsearch.rest.RestRequest.Method.GET; +import static org.elasticsearch.rest.RestRequest.Method.POST; /** * Class handling cluster allocation explanation at the REST level */ public class RestClusterAllocationExplainAction extends BaseRestHandler { - public RestClusterAllocationExplainAction(RestController controller) { - controller.registerHandler(RestRequest.Method.GET, "/_cluster/allocation/explain", this); - controller.registerHandler(RestRequest.Method.POST, "/_cluster/allocation/explain", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_cluster/allocation/explain", unmodifiableList(asList(GET, POST))) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterGetSettingsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterGetSettingsAction.java index 0a4d5b4e897f0..7538fe830c67e 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterGetSettingsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterGetSettingsAction.java @@ -25,6 +25,7 @@ import org.elasticsearch.client.Requests; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.cluster.ClusterState; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.settings.ClusterSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.SettingsFilter; @@ -32,29 +33,39 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; import java.util.Set; +import static java.util.Collections.singletonList; +import static org.elasticsearch.rest.RestRequest.Method.GET; + public class RestClusterGetSettingsAction extends BaseRestHandler { private final Settings settings; private final ClusterSettings clusterSettings; private final SettingsFilter settingsFilter; - public RestClusterGetSettingsAction(Settings settings, RestController controller, ClusterSettings clusterSettings, - SettingsFilter settingsFilter) { + public RestClusterGetSettingsAction(Settings settings, ClusterSettings clusterSettings, SettingsFilter settingsFilter) { this.settings = settings; this.clusterSettings = clusterSettings; - controller.registerHandler(RestRequest.Method.GET, "/_cluster/settings", this); this.settingsFilter = settingsFilter; } + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_cluster/settings", singletonList(GET)) + .map()); + } @Override public String getName() { return "cluster_get_settings_action"; diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterHealthAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterHealthAction.java index 63c6bc4c92c0b..82e67debc0880 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterHealthAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterHealthAction.java @@ -26,23 +26,31 @@ import org.elasticsearch.cluster.health.ClusterHealthStatus; import org.elasticsearch.common.Priority; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestStatusToXContentListener; import java.io.IOException; import java.util.Collections; +import java.util.List; import java.util.Locale; +import java.util.Map; import java.util.Set; +import static java.util.Collections.singletonList; import static org.elasticsearch.client.Requests.clusterHealthRequest; +import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestClusterHealthAction extends BaseRestHandler { - public RestClusterHealthAction(RestController controller) { - controller.registerHandler(RestRequest.Method.GET, "/_cluster/health", this); - controller.registerHandler(RestRequest.Method.GET, "/_cluster/health/{index}", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_cluster/health", singletonList(GET)) + .put("/_cluster/health/{index}", singletonList(GET)) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterRerouteAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterRerouteAction.java index 30799cb0552c0..69bc807b75ec6 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterRerouteAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterRerouteAction.java @@ -26,21 +26,27 @@ import org.elasticsearch.cluster.routing.allocation.command.AllocationCommands; import org.elasticsearch.common.ParseField; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.SettingsFilter; import org.elasticsearch.common.xcontent.ObjectParser; import org.elasticsearch.common.xcontent.ObjectParser.ValueType; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; import java.util.Collections; import java.util.EnumSet; import java.util.HashSet; +import java.util.List; +import java.util.Map; import java.util.Set; +import static java.util.Collections.singletonList; +import static org.elasticsearch.rest.RestRequest.Method.POST; + public class RestClusterRerouteAction extends BaseRestHandler { private static final ObjectParser PARSER = new ObjectParser<>("cluster_reroute"); static { @@ -54,9 +60,15 @@ public class RestClusterRerouteAction extends BaseRestHandler { private final SettingsFilter settingsFilter; - public RestClusterRerouteAction(RestController controller, SettingsFilter settingsFilter) { + public RestClusterRerouteAction(SettingsFilter settingsFilter) { this.settingsFilter = settingsFilter; - controller.registerHandler(RestRequest.Method.POST, "/_cluster/reroute", this); + } + + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_cluster/reroute", singletonList(POST)) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterSearchShardsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterSearchShardsAction.java index 188691dacf5e2..22622d071346a 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterSearchShardsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterSearchShardsAction.java @@ -24,23 +24,30 @@ import org.elasticsearch.client.Requests; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestClusterSearchShardsAction extends BaseRestHandler { - public RestClusterSearchShardsAction(RestController controller) { - controller.registerHandler(GET, "/_search_shards", this); - controller.registerHandler(POST, "/_search_shards", this); - controller.registerHandler(GET, "/{index}/_search_shards", this); - controller.registerHandler(POST, "/{index}/_search_shards", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_search_shards", unmodifiableList(asList(GET, POST))) + .put("/{index}/_search_shards", unmodifiableList(asList(GET, POST))) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterStateAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterStateAction.java index 9838cc26625fa..26b3f71d7bfaa 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterStateAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterStateAction.java @@ -26,13 +26,14 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.SettingsFilter; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -41,17 +42,18 @@ import java.util.Collections; import java.util.EnumSet; import java.util.HashSet; +import java.util.List; +import java.util.Map; import java.util.Set; +import static java.util.Collections.singletonList; +import static org.elasticsearch.rest.RestRequest.Method.GET; + public class RestClusterStateAction extends BaseRestHandler { private final SettingsFilter settingsFilter; - public RestClusterStateAction(RestController controller, SettingsFilter settingsFilter) { - controller.registerHandler(RestRequest.Method.GET, "/_cluster/state", this); - controller.registerHandler(RestRequest.Method.GET, "/_cluster/state/{metric}", this); - controller.registerHandler(RestRequest.Method.GET, "/_cluster/state/{metric}/{indices}", this); - + public RestClusterStateAction(SettingsFilter settingsFilter) { this.settingsFilter = settingsFilter; } @@ -60,6 +62,15 @@ public String getName() { return "cluster_state_action"; } + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_cluster/state", singletonList(GET)) + .put("/_cluster/state/{metric}", singletonList(GET)) + .put("/_cluster/state/{metric}/{indices}", singletonList(GET)) + .map()); + } + @Override public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException { final ClusterStateRequest clusterStateRequest = Requests.clusterStateRequest(); diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterStatsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterStatsAction.java index c7bfc640e76b4..dba1711c48439 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterStatsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterStatsAction.java @@ -21,18 +21,28 @@ import org.elasticsearch.action.admin.cluster.stats.ClusterStatsRequest; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestActions.NodesResponseRestListener; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestClusterStatsAction extends BaseRestHandler { - public RestClusterStatsAction(RestController controller) { - controller.registerHandler(RestRequest.Method.GET, "/_cluster/stats", this); - controller.registerHandler(RestRequest.Method.GET, "/_cluster/stats/nodes/{nodeId}", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_cluster/stats", singletonList(GET)) + .put("/_cluster/stats/nodes/{nodeId}", singletonList(GET)) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterUpdateSettingsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterUpdateSettingsAction.java index 35874f12d5fe1..1bddfa7b8b308 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterUpdateSettingsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterUpdateSettingsAction.java @@ -22,24 +22,33 @@ import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest; import org.elasticsearch.client.Requests; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.Collections; +import java.util.List; import java.util.Map; import java.util.Set; +import static java.util.Collections.singletonList; +import static org.elasticsearch.rest.RestRequest.Method.PUT; + public class RestClusterUpdateSettingsAction extends BaseRestHandler { private static final String PERSISTENT = "persistent"; private static final String TRANSIENT = "transient"; - public RestClusterUpdateSettingsAction(RestController controller) { - controller.registerHandler(RestRequest.Method.PUT, "/_cluster/settings", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_cluster/settings", singletonList(PUT)) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCreateSnapshotAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCreateSnapshotAction.java index 185a1659738ff..74ab9aa2fbf90 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCreateSnapshotAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCreateSnapshotAction.java @@ -21,13 +21,19 @@ import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotRequest; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.client.Requests.createSnapshotRequest; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.RestRequest.Method.PUT; @@ -37,9 +43,11 @@ */ public class RestCreateSnapshotAction extends BaseRestHandler { - public RestCreateSnapshotAction(RestController controller) { - controller.registerHandler(PUT, "/_snapshot/{repository}/{snapshot}", this); - controller.registerHandler(POST, "/_snapshot/{repository}/{snapshot}", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_snapshot/{repository}/{snapshot}", unmodifiableList(asList(PUT, POST))) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteRepositoryAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteRepositoryAction.java index 81914718b07df..d2fb0d8426311 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteRepositoryAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteRepositoryAction.java @@ -21,13 +21,18 @@ import org.elasticsearch.action.admin.cluster.repositories.delete.DeleteRepositoryRequest; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import static java.util.Collections.singletonList; import static org.elasticsearch.client.Requests.deleteRepositoryRequest; import static org.elasticsearch.rest.RestRequest.Method.DELETE; @@ -36,8 +41,11 @@ */ public class RestDeleteRepositoryAction extends BaseRestHandler { - public RestDeleteRepositoryAction(RestController controller) { - controller.registerHandler(DELETE, "/_snapshot/{repository}", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_snapshot/{repository}", singletonList(DELETE)) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteSnapshotAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteSnapshotAction.java index 81a3ddd31c59a..21fd9fb56d0c4 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteSnapshotAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteSnapshotAction.java @@ -21,13 +21,18 @@ import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotRequest; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import static java.util.Collections.singletonList; import static org.elasticsearch.client.Requests.deleteSnapshotRequest; import static org.elasticsearch.rest.RestRequest.Method.DELETE; @@ -36,8 +41,11 @@ */ public class RestDeleteSnapshotAction extends BaseRestHandler { - public RestDeleteSnapshotAction(RestController controller) { - controller.registerHandler(DELETE, "/_snapshot/{repository}/{snapshot}", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_snapshot/{repository}/{snapshot}", singletonList(DELETE)) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteStoredScriptAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteStoredScriptAction.java index a0258974cfc41..f3e6125be9eb8 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteStoredScriptAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteStoredScriptAction.java @@ -20,19 +20,27 @@ import org.elasticsearch.action.admin.cluster.storedscripts.DeleteStoredScriptRequest; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import static java.util.Collections.singletonList; import static org.elasticsearch.rest.RestRequest.Method.DELETE; public class RestDeleteStoredScriptAction extends BaseRestHandler { - public RestDeleteStoredScriptAction(RestController controller) { - controller.registerHandler(DELETE, "/_scripts/{id}", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_scripts/{id}", singletonList(DELETE)) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetRepositoriesAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetRepositoriesAction.java index 5b39a7e6df34f..1d610e353e13f 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetRepositoriesAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetRepositoriesAction.java @@ -22,16 +22,21 @@ import org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesRequest; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.SettingsFilter; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; import java.util.Set; +import static java.util.Collections.singletonList; import static org.elasticsearch.client.Requests.getRepositoryRequest; import static org.elasticsearch.rest.RestRequest.Method.GET; @@ -42,9 +47,7 @@ public class RestGetRepositoriesAction extends BaseRestHandler { private final SettingsFilter settingsFilter; - public RestGetRepositoriesAction(RestController controller, SettingsFilter settingsFilter) { - controller.registerHandler(GET, "/_snapshot", this); - controller.registerHandler(GET, "/_snapshot/{repository}", this); + public RestGetRepositoriesAction(SettingsFilter settingsFilter) { this.settingsFilter = settingsFilter; } @@ -53,6 +56,14 @@ public String getName() { return "get_repositories_action"; } + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_snapshot", singletonList(GET)) + .put("/_snapshot/{repository}", singletonList(GET)) + .map()); + } + @Override public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException { final String[] repositories = request.paramAsStringArray("repository", Strings.EMPTY_ARRAY); diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetScriptContextAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetScriptContextAction.java index 9a40225b769ba..a2240c2494539 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetScriptContextAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetScriptContextAction.java @@ -22,20 +22,24 @@ import org.elasticsearch.action.admin.cluster.storedscripts.GetScriptContextAction; import org.elasticsearch.action.admin.cluster.storedscripts.GetScriptContextRequest; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.common.inject.Inject; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import static java.util.Collections.singletonList; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestGetScriptContextAction extends BaseRestHandler { - @Inject - public RestGetScriptContextAction(RestController controller) { - controller.registerHandler(GET, "/_script_context", this); + + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(Collections.singletonMap("/_script_context", singletonList(GET))); } @Override public String getName() { diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetScriptLanguageAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetScriptLanguageAction.java index c9246b910cf4f..0c5c2498f219d 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetScriptLanguageAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetScriptLanguageAction.java @@ -22,20 +22,24 @@ import org.elasticsearch.action.admin.cluster.storedscripts.GetScriptLanguageAction; import org.elasticsearch.action.admin.cluster.storedscripts.GetScriptLanguageRequest; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.common.inject.Inject; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.List; +import java.util.Map; +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestGetScriptLanguageAction extends BaseRestHandler { - @Inject - public RestGetScriptLanguageAction(RestController controller) { - controller.registerHandler(GET, "/_script_language", this); + + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_script_language", singletonList(GET)); } @Override public String getName() { diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetSnapshotsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetSnapshotsAction.java index f47ddefa8f67a..18ca178e9e96e 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetSnapshotsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetSnapshotsAction.java @@ -23,12 +23,16 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.List; +import java.util.Map; +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.elasticsearch.client.Requests.getSnapshotsRequest; import static org.elasticsearch.rest.RestRequest.Method.GET; @@ -37,8 +41,9 @@ */ public class RestGetSnapshotsAction extends BaseRestHandler { - public RestGetSnapshotsAction(RestController controller) { - controller.registerHandler(GET, "/_snapshot/{repository}/{snapshot}", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_snapshot/{repository}/{snapshot}", singletonList(GET)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetStoredScriptAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetStoredScriptAction.java index f87c6f513b79c..2e8baca6fca05 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetStoredScriptAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetStoredScriptAction.java @@ -21,18 +21,23 @@ import org.elasticsearch.action.admin.cluster.storedscripts.GetStoredScriptRequest; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestStatusToXContentListener; import java.io.IOException; +import java.util.List; +import java.util.Map; +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestGetStoredScriptAction extends BaseRestHandler { - public RestGetStoredScriptAction(RestController controller) { - controller.registerHandler(GET, "/_scripts/{id}", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_scripts/{id}", singletonList(GET)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetTaskAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetTaskAction.java index f0ca02f43bc35..a42dd628b33e4 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetTaskAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetTaskAction.java @@ -23,19 +23,24 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.tasks.TaskId; import java.io.IOException; +import java.util.List; +import java.util.Map; +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestGetTaskAction extends BaseRestHandler { - public RestGetTaskAction(RestController controller) { - controller.registerHandler(GET, "/_tasks/{task_id}", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_tasks/{task_id}", singletonList(GET)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestListTasksAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestListTasksAction.java index 4627b853ac714..aaa5996283227 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestListTasksAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestListTasksAction.java @@ -30,8 +30,8 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestChannel; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -39,8 +39,12 @@ import org.elasticsearch.tasks.TaskId; import java.io.IOException; +import java.util.List; +import java.util.Map; import java.util.function.Supplier; +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; @@ -48,9 +52,13 @@ public class RestListTasksAction extends BaseRestHandler { private final Supplier nodesInCluster; - public RestListTasksAction(RestController controller, Supplier nodesInCluster) { + public RestListTasksAction(Supplier nodesInCluster) { this.nodesInCluster = nodesInCluster; - controller.registerHandler(GET, "/_tasks", this); + } + + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_tasks", singletonList(GET)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesHotThreadsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesHotThreadsAction.java index 07b85266d9d8c..17fdd09a69a52 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesHotThreadsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesHotThreadsAction.java @@ -24,30 +24,39 @@ import org.elasticsearch.action.admin.cluster.node.hotthreads.NodesHotThreadsResponse; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestResponseListener; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import static java.util.Collections.singletonList; +import static org.elasticsearch.rest.RestRequest.Method.GET; -public class RestNodesHotThreadsAction extends BaseRestHandler { - public RestNodesHotThreadsAction(RestController controller) { - controller.registerHandler(RestRequest.Method.GET, "/_cluster/nodes/hotthreads", this); - controller.registerHandler(RestRequest.Method.GET, "/_cluster/nodes/hot_threads", this); - controller.registerHandler(RestRequest.Method.GET, "/_cluster/nodes/{nodeId}/hotthreads", this); - controller.registerHandler(RestRequest.Method.GET, "/_cluster/nodes/{nodeId}/hot_threads", this); +public class RestNodesHotThreadsAction extends BaseRestHandler { - controller.registerHandler(RestRequest.Method.GET, "/_nodes/hotthreads", this); - controller.registerHandler(RestRequest.Method.GET, "/_nodes/hot_threads", this); - controller.registerHandler(RestRequest.Method.GET, "/_nodes/{nodeId}/hotthreads", this); - controller.registerHandler(RestRequest.Method.GET, "/_nodes/{nodeId}/hot_threads", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_cluster/nodes/hotthreads", singletonList(GET)) + .put("/_cluster/nodes/hot_threads", singletonList(GET)) + .put("/_cluster/nodes/{nodeId}/hotthreads", singletonList(GET)) + .put("/_cluster/nodes/{nodeId}/hot_threads", singletonList(GET)) + .put("/_nodes/hotthreads", singletonList(GET)) + .put("/_nodes/hot_threads", singletonList(GET)) + .put("/_nodes/{nodeId}/hotthreads", singletonList(GET)) + .put("/_nodes/{nodeId}/hot_threads", singletonList(GET)) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesInfoAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesInfoAction.java index ab39c4408f212..464eb04e00114 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesInfoAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesInfoAction.java @@ -22,17 +22,22 @@ import org.elasticsearch.action.admin.cluster.node.info.NodesInfoRequest; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.SettingsFilter; import org.elasticsearch.common.util.set.Sets; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestActions.NodesResponseRestListener; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; import java.util.Set; +import static java.util.Collections.singletonList; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestNodesInfoAction extends BaseRestHandler { @@ -50,17 +55,22 @@ public class RestNodesInfoAction extends BaseRestHandler { private final SettingsFilter settingsFilter; - public RestNodesInfoAction(RestController controller, SettingsFilter settingsFilter) { - controller.registerHandler(GET, "/_nodes", this); - // this endpoint is used for metrics, not for node IDs, like /_nodes/fs - controller.registerHandler(GET, "/_nodes/{nodeId}", this); - controller.registerHandler(GET, "/_nodes/{nodeId}/{metrics}", this); - // added this endpoint to be aligned with stats - controller.registerHandler(GET, "/_nodes/{nodeId}/info/{metrics}", this); - + public RestNodesInfoAction(SettingsFilter settingsFilter) { this.settingsFilter = settingsFilter; } + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_nodes", singletonList(GET)) + // this endpoint is used for metrics, not for node IDs, like /_nodes/fs + .put("/_nodes/{nodeId}", singletonList(GET)) + .put("/_nodes/{nodeId}/{metrics}", singletonList(GET)) + // added this endpoint to be aligned with stats + .put("/_nodes/{nodeId}/info/{metrics}", singletonList(GET)) + .map()); + } + @Override public String getName() { return "nodes_info_action"; diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsAction.java index f8127b32db0a6..a3efb2d95ac65 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsAction.java @@ -24,35 +24,38 @@ import org.elasticsearch.action.admin.indices.stats.CommonStatsFlags.Flag; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestActions.NodesResponseRestListener; import java.io.IOException; import java.util.Collections; import java.util.HashMap; +import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Set; import java.util.TreeSet; import java.util.function.Consumer; +import static java.util.Collections.singletonList; import static java.util.Map.entry; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestNodesStatsAction extends BaseRestHandler { - public RestNodesStatsAction(RestController controller) { - controller.registerHandler(GET, "/_nodes/stats", this); - controller.registerHandler(GET, "/_nodes/{nodeId}/stats", this); - - controller.registerHandler(GET, "/_nodes/stats/{metric}", this); - controller.registerHandler(GET, "/_nodes/{nodeId}/stats/{metric}", this); - - controller.registerHandler(GET, "/_nodes/stats/{metric}/{index_metric}", this); - - controller.registerHandler(GET, "/_nodes/{nodeId}/stats/{metric}/{index_metric}", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_nodes/stats", singletonList(GET)) + .put("/_nodes/{nodeId}/stats", singletonList(GET)) + .put("/_nodes/stats/{metric}", singletonList(GET)) + .put("/_nodes/{nodeId}/stats/{metric}", singletonList(GET)) + .put("/_nodes/stats/{metric}/{index_metric}", singletonList(GET)) + .put("/_nodes/{nodeId}/stats/{metric}/{index_metric}", singletonList(GET)) + .map()); } static final Map> METRICS = Map.ofEntries( diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesUsageAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesUsageAction.java index f1a3b15d8b654..191086d4c11f3 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesUsageAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesUsageAction.java @@ -23,32 +23,37 @@ import org.elasticsearch.action.admin.cluster.node.usage.NodesUsageResponse; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.inject.Inject; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestActions; import org.elasticsearch.rest.action.RestBuilderListener; import java.io.IOException; +import java.util.Collections; +import java.util.List; import java.util.Locale; +import java.util.Map; import java.util.Set; +import static java.util.Collections.singletonList; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestNodesUsageAction extends BaseRestHandler { - @Inject - public RestNodesUsageAction(RestController controller) { - controller.registerHandler(GET, "/_nodes/usage", this); - controller.registerHandler(GET, "/_nodes/{nodeId}/usage", this); - - controller.registerHandler(GET, "/_nodes/usage/{metric}", this); - controller.registerHandler(GET, "/_nodes/{nodeId}/usage/{metric}", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_nodes/usage", singletonList(GET)) + .put("/_nodes/{nodeId}/usage", singletonList(GET)) + .put("/_nodes/usage/{metric}", singletonList(GET)) + .put("/_nodes/{nodeId}/usage/{metric}", singletonList(GET)) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPendingClusterTasksAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPendingClusterTasksAction.java index dbf03e35130c6..201ce1cf12364 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPendingClusterTasksAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPendingClusterTasksAction.java @@ -22,16 +22,23 @@ import org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksRequest; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestPendingClusterTasksAction extends BaseRestHandler { - public RestPendingClusterTasksAction(RestController controller) { - controller.registerHandler(RestRequest.Method.GET, "/_cluster/pending_tasks", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_cluster/pending_tasks", singletonList(GET)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPutRepositoryAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPutRepositoryAction.java index 150296d65aea9..1436146d7db51 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPutRepositoryAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPutRepositoryAction.java @@ -23,12 +23,17 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.List; +import java.util.Map; +import static java.util.Arrays.asList; +import static java.util.Collections.singletonMap; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.client.Requests.putRepositoryRequest; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.RestRequest.Method.PUT; @@ -38,9 +43,9 @@ */ public class RestPutRepositoryAction extends BaseRestHandler { - public RestPutRepositoryAction(RestController controller) { - controller.registerHandler(PUT, "/_snapshot/{repository}", this); - controller.registerHandler(POST, "/_snapshot/{repository}", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_snapshot/{repository}", unmodifiableList(asList(PUT, POST))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPutStoredScriptAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPutStoredScriptAction.java index 2e316abc14296..3e1432429313e 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPutStoredScriptAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPutStoredScriptAction.java @@ -21,25 +21,32 @@ import org.elasticsearch.action.admin.cluster.storedscripts.PutStoredScriptRequest; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.bytes.BytesReference; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.script.StoredScriptSource; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.RestRequest.Method.PUT; public class RestPutStoredScriptAction extends BaseRestHandler { - public RestPutStoredScriptAction(RestController controller) { - controller.registerHandler(POST, "/_scripts/{id}", this); - controller.registerHandler(PUT, "/_scripts/{id}", this); - controller.registerHandler(POST, "/_scripts/{id}/{context}", this); - controller.registerHandler(PUT, "/_scripts/{id}/{context}", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_scripts/{id}", unmodifiableList(asList(PUT, POST))) + .put("/_scripts/{id}/{context}", unmodifiableList(asList(PUT, POST))) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestReloadSecureSettingsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestReloadSecureSettingsAction.java index e5f85c569ee6b..4708653eed288 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestReloadSecureSettingsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestReloadSecureSettingsAction.java @@ -25,20 +25,25 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.ParseField; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.settings.SecureString; import org.elasticsearch.common.xcontent.ObjectParser; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestActions; import org.elasticsearch.rest.action.RestBuilderListener; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import static java.util.Collections.singletonList; import static org.elasticsearch.rest.RestRequest.Method.POST; public final class RestReloadSecureSettingsAction extends BaseRestHandler { @@ -51,16 +56,19 @@ public final class RestReloadSecureSettingsAction extends BaseRestHandler { new ParseField("secure_settings_password")); } - public RestReloadSecureSettingsAction(RestController controller) { - controller.registerHandler(POST, "/_nodes/reload_secure_settings", this); - controller.registerHandler(POST, "/_nodes/{nodeId}/reload_secure_settings", this); - } - @Override public String getName() { return "nodes_reload_action"; } + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_nodes/reload_secure_settings", singletonList(POST)) + .put("/_nodes/{nodeId}/reload_secure_settings", singletonList(POST)) + .map()); + } + @Override public RestChannelConsumer prepareRequest(RestRequest request, NodeClient client) throws IOException { final String[] nodesIds = Strings.splitStringByCommaToArray(request.param("nodeId")); diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestRemoteClusterInfoAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestRemoteClusterInfoAction.java index a49f6d1319ba2..0e68f6aa4cf4b 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestRemoteClusterInfoAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestRemoteClusterInfoAction.java @@ -23,16 +23,22 @@ import org.elasticsearch.action.admin.cluster.remote.RemoteInfoRequest; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; public final class RestRemoteClusterInfoAction extends BaseRestHandler { - public RestRemoteClusterInfoAction(RestController controller) { - controller.registerHandler(GET, "_remote/info", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("_remote/info", singletonList(GET)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestRestoreSnapshotAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestRestoreSnapshotAction.java index fb47e928ab87e..69c99498b10e5 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestRestoreSnapshotAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestRestoreSnapshotAction.java @@ -22,12 +22,16 @@ import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotRequest; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.List; +import java.util.Map; +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.elasticsearch.client.Requests.restoreSnapshotRequest; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -36,8 +40,9 @@ */ public class RestRestoreSnapshotAction extends BaseRestHandler { - public RestRestoreSnapshotAction(RestController controller) { - controller.registerHandler(POST, "/_snapshot/{repository}/{snapshot}/_restore", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_snapshot/{repository}/{snapshot}/_restore", singletonList(POST)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestSnapshotsStatusAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestSnapshotsStatusAction.java index f8347d38cd576..e31dc2d3cac97 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestSnapshotsStatusAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestSnapshotsStatusAction.java @@ -22,13 +22,18 @@ import org.elasticsearch.action.admin.cluster.snapshots.status.SnapshotsStatusRequest; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import static java.util.Collections.singletonList; import static org.elasticsearch.client.Requests.snapshotsStatusRequest; import static org.elasticsearch.rest.RestRequest.Method.GET; @@ -37,10 +42,13 @@ */ public class RestSnapshotsStatusAction extends BaseRestHandler { - public RestSnapshotsStatusAction(RestController controller) { - controller.registerHandler(GET, "/_snapshot/{repository}/{snapshot}/_status", this); - controller.registerHandler(GET, "/_snapshot/{repository}/_status", this); - controller.registerHandler(GET, "/_snapshot/_status", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_snapshot/{repository}/{snapshot}/_status", singletonList(GET)) + .put("/_snapshot/{repository}/_status", singletonList(GET)) + .put("/_snapshot/_status", singletonList(GET)) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestVerifyRepositoryAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestVerifyRepositoryAction.java index be69e73275c81..15c3c155c9c0b 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestVerifyRepositoryAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestVerifyRepositoryAction.java @@ -22,19 +22,24 @@ import org.elasticsearch.action.admin.cluster.repositories.verify.VerifyRepositoryRequest; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.List; +import java.util.Map; +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.elasticsearch.client.Requests.verifyRepositoryRequest; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestVerifyRepositoryAction extends BaseRestHandler { - public RestVerifyRepositoryAction(RestController controller) { - controller.registerHandler(POST, "/_snapshot/{repository}/_verify", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_snapshot/{repository}/_verify", singletonList(POST)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestAnalyzeAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestAnalyzeAction.java index af9bfbfe595dd..0c6eaf25a2ee9 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestAnalyzeAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestAnalyzeAction.java @@ -21,14 +21,20 @@ import org.elasticsearch.action.admin.indices.analyze.AnalyzeAction; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.ParseField; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -46,11 +52,12 @@ public static class Fields { public static final ParseField NORMALIZER = new ParseField("normalizer"); } - public RestAnalyzeAction(RestController controller) { - controller.registerHandler(GET, "/_analyze", this); - controller.registerHandler(GET, "/{index}/_analyze", this); - controller.registerHandler(POST, "/_analyze", this); - controller.registerHandler(POST, "/{index}/_analyze", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_analyze", unmodifiableList(asList(GET, POST))) + .put("/{index}/_analyze", unmodifiableList(asList(GET, POST))) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestClearIndicesCacheAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestClearIndicesCacheAction.java index bc2fed911b3ac..30d67849b6917 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestClearIndicesCacheAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestClearIndicesCacheAction.java @@ -23,20 +23,28 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import static java.util.Collections.singletonList; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestClearIndicesCacheAction extends BaseRestHandler { - public RestClearIndicesCacheAction(RestController controller) { - controller.registerHandler(POST, "/_cache/clear", this); - controller.registerHandler(POST, "/{index}/_cache/clear", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_cache/clear", singletonList(POST)) + .put("/{index}/_cache/clear", singletonList(POST)) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCloseIndexAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCloseIndexAction.java index 3f26b1978372d..51e62d4d8cb28 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCloseIndexAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCloseIndexAction.java @@ -24,18 +24,28 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestCloseIndexAction extends BaseRestHandler { - public RestCloseIndexAction(RestController controller) { - controller.registerHandler(RestRequest.Method.POST, "/_close", this); - controller.registerHandler(RestRequest.Method.POST, "/{index}/_close", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_close", singletonList(POST)) + .put("/{index}/_close", singletonList(POST)) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCreateIndexAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCreateIndexAction.java index a43c508f7487a..9227b475619e0 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCreateIndexAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCreateIndexAction.java @@ -26,19 +26,24 @@ import org.elasticsearch.common.xcontent.XContentHelper; import org.elasticsearch.index.mapper.MapperService; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; -import java.util.Collections; import java.util.HashMap; +import java.util.List; import java.util.Map; +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.PUT; + public class RestCreateIndexAction extends BaseRestHandler { - public RestCreateIndexAction(RestController controller) { - controller.registerHandler(RestRequest.Method.PUT, "/{index}", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/{index}", singletonList(PUT)); } @Override @@ -79,7 +84,7 @@ static Map prepareMappings(Map source) { throw new IllegalArgumentException("The mapping definition cannot be nested under a type"); } - newSource.put("mappings", Collections.singletonMap(MapperService.SINGLE_MAPPING_NAME, mappings)); + newSource.put("mappings", singletonMap(MapperService.SINGLE_MAPPING_NAME, mappings)); return newSource; } } diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestDeleteIndexAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestDeleteIndexAction.java index b0d02cd19b7eb..a2f1a22bb87ae 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestDeleteIndexAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestDeleteIndexAction.java @@ -23,18 +23,28 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static org.elasticsearch.rest.RestRequest.Method.DELETE; public class RestDeleteIndexAction extends BaseRestHandler { - public RestDeleteIndexAction(RestController controller) { - controller.registerHandler(RestRequest.Method.DELETE, "/", this); - controller.registerHandler(RestRequest.Method.DELETE, "/{index}", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/", singletonList(DELETE)) + .put("/{index}", singletonList(DELETE)) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestDeleteIndexTemplateAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestDeleteIndexTemplateAction.java index c0679bb356249..ea22cdcfdc1bb 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestDeleteIndexTemplateAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestDeleteIndexTemplateAction.java @@ -21,16 +21,23 @@ import org.elasticsearch.action.admin.indices.template.delete.DeleteIndexTemplateRequest; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.DELETE; public class RestDeleteIndexTemplateAction extends BaseRestHandler { - public RestDeleteIndexTemplateAction(RestController controller) { - controller.registerHandler(RestRequest.Method.DELETE, "/_template/{name}", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_template/{name}", singletonList(DELETE)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestFlushAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestFlushAction.java index f9d614e9b9912..7b2feb2ee7a5e 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestFlushAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestFlushAction.java @@ -23,24 +23,30 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestFlushAction extends BaseRestHandler { - public RestFlushAction(RestController controller) { - controller.registerHandler(POST, "/_flush", this); - controller.registerHandler(POST, "/{index}/_flush", this); - - controller.registerHandler(GET, "/_flush", this); - controller.registerHandler(GET, "/{index}/_flush", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_flush", unmodifiableList(asList(POST, GET))) + .put("/{index}/_flush", unmodifiableList(asList(POST, GET))) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestForceMergeAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestForceMergeAction.java index e6f5ef549d1c0..17198f6c40605 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestForceMergeAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestForceMergeAction.java @@ -23,20 +23,28 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import static java.util.Collections.singletonList; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestForceMergeAction extends BaseRestHandler { - public RestForceMergeAction(final RestController controller) { - controller.registerHandler(POST, "/_forcemerge", this); - controller.registerHandler(POST, "/{index}/_forcemerge", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_forcemerge", singletonList(POST)) + .put("/{index}/_forcemerge", singletonList(POST)) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetAliasesAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetAliasesAction.java index 3379ab009573f..21bcab41bdac2 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetAliasesAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetAliasesAction.java @@ -28,25 +28,31 @@ import org.elasticsearch.cluster.metadata.MetaData; import org.elasticsearch.common.Strings; import org.elasticsearch.common.collect.ImmutableOpenMap; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.regex.Regex; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; import java.io.IOException; +import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Locale; +import java.util.Map; import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; +import static java.util.Arrays.asList; +import static java.util.Collections.singletonList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.HEAD; @@ -55,15 +61,15 @@ */ public class RestGetAliasesAction extends BaseRestHandler { - public RestGetAliasesAction(final RestController controller) { - controller.registerHandler(GET, "/_alias", this); - controller.registerHandler(GET, "/_aliases", this); - controller.registerHandler(GET, "/_alias/{name}", this); - controller.registerHandler(HEAD, "/_alias/{name}", this); - controller.registerHandler(GET, "/{index}/_alias", this); - controller.registerHandler(HEAD, "/{index}/_alias", this); - controller.registerHandler(GET, "/{index}/_alias/{name}", this); - controller.registerHandler(HEAD, "/{index}/_alias/{name}", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_alias", singletonList(GET)) + .put("/_aliases", singletonList(GET)) + .put("/_alias/{name}", unmodifiableList(asList(GET, HEAD))) + .put("/{index}/_alias", unmodifiableList(asList(GET, HEAD))) + .put("/{index}/_alias/{name}", unmodifiableList(asList(GET, HEAD))) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetFieldMappingAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetFieldMappingAction.java index d4a5a0cb58140..ed298bf612f79 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetFieldMappingAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetFieldMappingAction.java @@ -25,27 +25,34 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; import java.io.IOException; +import java.util.Collections; +import java.util.List; import java.util.Map; +import static java.util.Collections.singletonList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestStatus.NOT_FOUND; import static org.elasticsearch.rest.RestStatus.OK; public class RestGetFieldMappingAction extends BaseRestHandler { - public RestGetFieldMappingAction(RestController controller) { - controller.registerHandler(GET, "/_mapping/field/{fields}", this); - controller.registerHandler(GET, "/{index}/_mapping/field/{fields}", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_mapping/field/{fields}", singletonList(GET)) + .put("/{index}/_mapping/field/{fields}", singletonList(GET)) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndexTemplateAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndexTemplateAction.java index 0c99ccef08e8c..168f91690e074 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndexTemplateAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndexTemplateAction.java @@ -23,16 +23,23 @@ import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; import java.util.Set; +import static java.util.Arrays.asList; +import static java.util.Collections.singletonList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.HEAD; import static org.elasticsearch.rest.RestStatus.NOT_FOUND; @@ -43,10 +50,12 @@ */ public class RestGetIndexTemplateAction extends BaseRestHandler { - public RestGetIndexTemplateAction(final RestController controller) { - controller.registerHandler(GET, "/_template", this); - controller.registerHandler(GET, "/_template/{name}", this); - controller.registerHandler(HEAD, "/_template/{name}", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_template", singletonList(GET)) + .put("/_template/{name}", unmodifiableList(asList(GET, HEAD))) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndicesAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndicesAction.java index e39ff1cf70170..e1de4f702a713 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndicesAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndicesAction.java @@ -26,13 +26,18 @@ import org.elasticsearch.common.Strings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.List; +import java.util.Map; import java.util.Set; +import static java.util.Arrays.asList; +import static java.util.Collections.singletonMap; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.HEAD; @@ -41,9 +46,9 @@ */ public class RestGetIndicesAction extends BaseRestHandler { - public RestGetIndicesAction(final RestController controller) { - controller.registerHandler(GET, "/{index}", this); - controller.registerHandler(HEAD, "/{index}", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/{index}", unmodifiableList(asList(GET, HEAD))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetMappingAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetMappingAction.java index f42099e4219aa..e76a69d476b2f 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetMappingAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetMappingAction.java @@ -24,26 +24,34 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import static java.util.Collections.singletonList; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestGetMappingAction extends BaseRestHandler { - public RestGetMappingAction(final RestController controller) { - controller.registerHandler(GET, "/_mapping", this); - controller.registerHandler(GET, "/_mappings", this); - controller.registerHandler(GET, "/{index}/_mappings", this); - controller.registerHandler(GET, "/{index}/_mapping", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_mapping", singletonList(GET)) + .put("/_mappings", singletonList(GET)) + .put("/{index}/_mapping", singletonList(GET)) + .put("/{index}/_mappings", singletonList(GET)) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetSettingsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetSettingsAction.java index c7b9cc485d3ce..9bde53d8a0edf 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetSettingsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetSettingsAction.java @@ -23,23 +23,31 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import static java.util.Collections.singletonList; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestGetSettingsAction extends BaseRestHandler { - public RestGetSettingsAction(RestController controller) { - controller.registerHandler(GET, "/_settings", this); - controller.registerHandler(GET, "/_settings/{name}", this); - controller.registerHandler(GET, "/{index}/_settings", this); - controller.registerHandler(GET, "/{index}/_settings/{name}", this); - controller.registerHandler(GET, "/{index}/_setting/{name}", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_settings", singletonList(GET)) + .put("/_settings/{name}", singletonList(GET)) + .put("/{index}/_settings", singletonList(GET)) + .put("/{index}/_settings/{name}", singletonList(GET)) + .put("/{index}/_setting/{name}", singletonList(GET)) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndexDeleteAliasesAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndexDeleteAliasesAction.java index 91442bb2fb9e1..19a86ff25f57f 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndexDeleteAliasesAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndexDeleteAliasesAction.java @@ -22,20 +22,28 @@ import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest.AliasActions; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import static java.util.Collections.singletonList; import static org.elasticsearch.rest.RestRequest.Method.DELETE; public class RestIndexDeleteAliasesAction extends BaseRestHandler { - public RestIndexDeleteAliasesAction(RestController controller) { - controller.registerHandler(DELETE, "/{index}/_alias/{name}", this); - controller.registerHandler(DELETE, "/{index}/_aliases/{name}", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/{index}/_alias/{name}", singletonList(DELETE)) + .put("/{index}/_aliases/{name}", singletonList(DELETE)) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndexPutAliasAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndexPutAliasAction.java index 3c51c9111f2ae..21dff51d7c4c7 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndexPutAliasAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndexPutAliasAction.java @@ -22,34 +22,38 @@ import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest.AliasActions; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.Collections; +import java.util.List; import java.util.Map; +import static java.util.Arrays.asList; +import static java.util.Collections.singletonList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.RestRequest.Method.PUT; public class RestIndexPutAliasAction extends BaseRestHandler { - public RestIndexPutAliasAction(RestController controller) { - controller.registerHandler(PUT, "/{index}/_alias/{name}", this); - controller.registerHandler(PUT, "/_alias/{name}", this); - controller.registerHandler(PUT, "/{index}/_aliases/{name}", this); - controller.registerHandler(PUT, "/_aliases/{name}", this); - controller.registerHandler(PUT, "/{index}/_alias", this); - controller.registerHandler(PUT, "/_alias", this); - - controller.registerHandler(POST, "/{index}/_alias/{name}", this); - controller.registerHandler(POST, "/_alias/{name}", this); - controller.registerHandler(POST, "/{index}/_aliases/{name}", this); - controller.registerHandler(POST, "/_aliases/{name}", this); - controller.registerHandler(PUT, "/{index}/_aliases", this); - //we cannot add POST for "/_aliases" because this is the _aliases api already defined in RestIndicesAliasesAction + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/{index}/_alias/{name}", unmodifiableList(asList(POST, PUT))) + .put("/_alias/{name}", unmodifiableList(asList(POST, PUT))) + .put("/{index}/_aliases/{name}", unmodifiableList(asList(POST, PUT))) + .put("/_aliases/{name}", unmodifiableList(asList(POST, PUT))) + .put("/{index}/_alias", singletonList(PUT)) + .put("/{index}/_aliases", singletonList(PUT)) + .put("/_alias", singletonList(PUT)) + .put("/{index}/_alias", singletonList(PUT)) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesAliasesAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesAliasesAction.java index d305c5ad3ca46..53d1e475aef21 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesAliasesAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesAliasesAction.java @@ -23,12 +23,16 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.List; +import java.util.Map; +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestIndicesAliasesAction extends BaseRestHandler { @@ -38,8 +42,9 @@ public String getName() { return "indices_aliases_action"; } - public RestIndicesAliasesAction(RestController controller) { - controller.registerHandler(POST, "/_aliases", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_aliases", singletonList(POST)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesSegmentsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesSegmentsAction.java index ed76c36dac34c..05107010e7128 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesSegmentsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesSegmentsAction.java @@ -23,20 +23,28 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import static java.util.Collections.singletonList; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestIndicesSegmentsAction extends BaseRestHandler { - public RestIndicesSegmentsAction(RestController controller) { - controller.registerHandler(GET, "/_segments", this); - controller.registerHandler(GET, "/{index}/_segments", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_segments", singletonList(GET)) + .put("/{index}/_segments", singletonList(GET)) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesShardStoresAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesShardStoresAction.java index e214e7bbb3411..82b32ac6df989 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesShardStoresAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesShardStoresAction.java @@ -25,16 +25,21 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestBuilderListener; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import static java.util.Collections.singletonList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestStatus.OK; @@ -43,9 +48,12 @@ */ public class RestIndicesShardStoresAction extends BaseRestHandler { - public RestIndicesShardStoresAction(RestController controller) { - controller.registerHandler(GET, "/_shard_stores", this); - controller.registerHandler(GET, "/{index}/_shard_stores", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_shard_stores", singletonList(GET)) + .put("/{index}/_shard_stores", singletonList(GET)) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsAction.java index 4562365c8abec..fcaa4d7e8c0bf 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsAction.java @@ -25,29 +25,35 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; import java.util.Collections; import java.util.HashMap; +import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Set; import java.util.TreeSet; import java.util.function.Consumer; +import static java.util.Collections.singletonList; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestIndicesStatsAction extends BaseRestHandler { - public RestIndicesStatsAction(RestController controller) { - controller.registerHandler(GET, "/_stats", this); - controller.registerHandler(GET, "/_stats/{metric}", this); - controller.registerHandler(GET, "/{index}/_stats", this); - controller.registerHandler(GET, "/{index}/_stats/{metric}", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_stats", singletonList(GET)) + .put("/_stats/{metric}", singletonList(GET)) + .put("/{index}/_stats", singletonList(GET)) + .put("/{index}/_stats/{metric}", singletonList(GET)) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestOpenIndexAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestOpenIndexAction.java index 8eb5c3a74bd73..27eff71bab1c8 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestOpenIndexAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestOpenIndexAction.java @@ -24,18 +24,28 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestOpenIndexAction extends BaseRestHandler { - public RestOpenIndexAction(RestController controller) { - controller.registerHandler(RestRequest.Method.POST, "/_open", this); - controller.registerHandler(RestRequest.Method.POST, "/{index}/_open", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_open", singletonList(POST)) + .put("/{index}/_open", singletonList(POST)) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutIndexTemplateAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutIndexTemplateAction.java index 68e62ac3c684f..2ef5a8f4e4500 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutIndexTemplateAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutIndexTemplateAction.java @@ -24,19 +24,25 @@ import org.elasticsearch.common.Strings; import org.elasticsearch.common.xcontent.XContentHelper; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; -import java.util.Arrays; +import java.util.List; import java.util.Map; +import static java.util.Arrays.asList; +import static java.util.Collections.singletonMap; +import static java.util.Collections.unmodifiableList; +import static org.elasticsearch.rest.RestRequest.Method.POST; +import static org.elasticsearch.rest.RestRequest.Method.PUT; + public class RestPutIndexTemplateAction extends BaseRestHandler { - public RestPutIndexTemplateAction(RestController controller) { - controller.registerHandler(RestRequest.Method.PUT, "/_template/{name}", this); - controller.registerHandler(RestRequest.Method.POST, "/_template/{name}", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_template/{name}", unmodifiableList(asList(PUT, POST))); } @Override @@ -48,7 +54,7 @@ public String getName() { public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException { PutIndexTemplateRequest putRequest = new PutIndexTemplateRequest(request.param("name")); - putRequest.patterns(Arrays.asList(request.paramAsStringArray("index_patterns", Strings.EMPTY_ARRAY))); + putRequest.patterns(asList(request.paramAsStringArray("index_patterns", Strings.EMPTY_ARRAY))); putRequest.order(request.paramAsInt("order", putRequest.order())); putRequest.masterNodeTimeout(request.paramAsTime("master_timeout", putRequest.masterNodeTimeout())); putRequest.create(request.paramAsBoolean("create", false)); diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutMappingAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutMappingAction.java index 3e9f984f15170..2d1d64ac52779 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutMappingAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutMappingAction.java @@ -23,29 +23,33 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.xcontent.XContentHelper; import org.elasticsearch.index.mapper.MapperService; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.Collections; +import java.util.List; import java.util.Map; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.client.Requests.putMappingRequest; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.RestRequest.Method.PUT; public class RestPutMappingAction extends BaseRestHandler { - public RestPutMappingAction(RestController controller) { - controller.registerHandler(PUT, "/{index}/_mapping/", this); - controller.registerHandler(POST, "/{index}/_mapping/", this); - - //register the same paths, but with plural form _mappings - controller.registerHandler(PUT, "/{index}/_mappings/", this); - controller.registerHandler(POST, "/{index}/_mappings/", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/{index}/_mapping/", unmodifiableList(asList(POST, PUT))) + .put("/{index}/_mappings/", unmodifiableList(asList(POST, PUT))) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRecoveryAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRecoveryAction.java index 38325a17f489d..e7590858e31f9 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRecoveryAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRecoveryAction.java @@ -23,13 +23,18 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import static java.util.Collections.singletonList; import static org.elasticsearch.rest.RestRequest.Method.GET; /** @@ -37,9 +42,12 @@ */ public class RestRecoveryAction extends BaseRestHandler { - public RestRecoveryAction(RestController controller) { - controller.registerHandler(GET, "/_recovery", this); - controller.registerHandler(GET, "/{index}/_recovery", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_recovery", singletonList(GET)) + .put("/{index}/_recovery", singletonList(GET)) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRefreshAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRefreshAction.java index 5e89e16d068fa..07754472021fd 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRefreshAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRefreshAction.java @@ -24,25 +24,31 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestRefreshAction extends BaseRestHandler { - public RestRefreshAction(RestController controller) { - controller.registerHandler(POST, "/_refresh", this); - controller.registerHandler(POST, "/{index}/_refresh", this); - - controller.registerHandler(GET, "/_refresh", this); - controller.registerHandler(GET, "/{index}/_refresh", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_refresh", unmodifiableList(asList(GET, POST))) + .put("/{index}/_refresh", unmodifiableList(asList(GET, POST))) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestResizeHandler.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestResizeHandler.java index 291cf61caf7b6..f0d7f2dfe37c5 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestResizeHandler.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestResizeHandler.java @@ -24,11 +24,19 @@ import org.elasticsearch.action.support.ActiveShardCount; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.List; +import java.util.Map; + +import static java.util.Arrays.asList; +import static java.util.Collections.singletonMap; +import static java.util.Collections.unmodifiableList; +import static org.elasticsearch.rest.RestRequest.Method.POST; +import static org.elasticsearch.rest.RestRequest.Method.PUT; public abstract class RestResizeHandler extends BaseRestHandler { @@ -53,9 +61,9 @@ public final RestChannelConsumer prepareRequest(final RestRequest request, final public static class RestShrinkIndexAction extends RestResizeHandler { - public RestShrinkIndexAction(final RestController controller) { - controller.registerHandler(RestRequest.Method.PUT, "/{index}/_shrink/{target}", this); - controller.registerHandler(RestRequest.Method.POST, "/{index}/_shrink/{target}", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/{index}/_shrink/{target}", unmodifiableList(asList(PUT, POST))); } @Override @@ -72,9 +80,9 @@ protected ResizeType getResizeType() { public static class RestSplitIndexAction extends RestResizeHandler { - public RestSplitIndexAction(final RestController controller) { - controller.registerHandler(RestRequest.Method.PUT, "/{index}/_split/{target}", this); - controller.registerHandler(RestRequest.Method.POST, "/{index}/_split/{target}", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/{index}/_split/{target}", unmodifiableList(asList(PUT, POST))); } @Override @@ -91,9 +99,9 @@ protected ResizeType getResizeType() { public static class RestCloneIndexAction extends RestResizeHandler { - public RestCloneIndexAction(final RestController controller) { - controller.registerHandler(RestRequest.Method.PUT, "/{index}/_clone/{target}", this); - controller.registerHandler(RestRequest.Method.POST, "/{index}/_clone/{target}", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/{index}/_clone/{target}", unmodifiableList(asList(PUT, POST))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRolloverIndexAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRolloverIndexAction.java index d90f0d7e23f19..135ec0dc094a6 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRolloverIndexAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRolloverIndexAction.java @@ -22,18 +22,28 @@ import org.elasticsearch.action.admin.indices.rollover.RolloverRequest; import org.elasticsearch.action.support.ActiveShardCount; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestRolloverIndexAction extends BaseRestHandler { - - public RestRolloverIndexAction(RestController controller) { - controller.registerHandler(RestRequest.Method.POST, "/{index}/_rollover", this); - controller.registerHandler(RestRequest.Method.POST, "/{index}/_rollover/{new_index}", this); + + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/{index}/_rollover", singletonList(POST)) + .put("/{index}/_rollover/{new_index}", singletonList(POST)) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestSyncedFlushAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestSyncedFlushAction.java index d775189af48e3..acfd2d51d3b66 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestSyncedFlushAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestSyncedFlushAction.java @@ -26,19 +26,25 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestChannel; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -47,12 +53,12 @@ public class RestSyncedFlushAction extends BaseRestHandler { private static final Logger logger = LogManager.getLogger(RestSyncedFlushAction.class); private static final DeprecationLogger DEPRECATION_LOGGER = new DeprecationLogger(logger); - public RestSyncedFlushAction(RestController controller) { - controller.registerHandler(POST, "/_flush/synced", this); - controller.registerHandler(POST, "/{index}/_flush/synced", this); - - controller.registerHandler(GET, "/_flush/synced", this); - controller.registerHandler(GET, "/{index}/_flush/synced", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_flush/synced", unmodifiableList(asList(GET, POST))) + .put("/{index}/_flush/synced", unmodifiableList(asList(GET, POST))) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpdateSettingsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpdateSettingsAction.java index e26bf9f318e5e..e525d529282e1 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpdateSettingsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpdateSettingsAction.java @@ -23,22 +23,31 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; import java.util.Set; +import static java.util.Collections.singletonList; import static org.elasticsearch.client.Requests.updateSettingsRequest; +import static org.elasticsearch.rest.RestRequest.Method.PUT; public class RestUpdateSettingsAction extends BaseRestHandler { - public RestUpdateSettingsAction(RestController controller) { - controller.registerHandler(RestRequest.Method.PUT, "/{index}/_settings", this); - controller.registerHandler(RestRequest.Method.PUT, "/_settings", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/{index}/_settings", singletonList(PUT)) + .put("/_settings", singletonList(PUT)) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpgradeActionDeprecated.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpgradeActionDeprecated.java index f63fe49ec6e91..63ad1736779cf 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpgradeActionDeprecated.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpgradeActionDeprecated.java @@ -26,12 +26,18 @@ import org.elasticsearch.common.Strings; import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import static java.util.Arrays.asList; +import static java.util.Collections.singletonList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestUpgradeActionDeprecated extends BaseRestHandler { @@ -42,11 +48,16 @@ public class RestUpgradeActionDeprecated extends BaseRestHandler { public static final String UPGRADE_API_DEPRECATION_MESSAGE = "The _upgrade API is no longer useful and will be removed. Instead, see _reindex API."; - public RestUpgradeActionDeprecated(RestController controller) { - controller.registerAsDeprecatedHandler(POST, "/_upgrade", this, - UPGRADE_API_DEPRECATION_MESSAGE, deprecationLogger); - controller.registerAsDeprecatedHandler(POST, "/{index}/_upgrade", this, - UPGRADE_API_DEPRECATION_MESSAGE, deprecationLogger); + @Override + public List deprecatedHandledMethodsAndPaths() { + return unmodifiableList(asList( + new DeprecatedRestApi("/_upgrade", singletonList(POST), UPGRADE_API_DEPRECATION_MESSAGE, deprecationLogger), + new DeprecatedRestApi("/{index}/_upgrade", singletonList(POST), UPGRADE_API_DEPRECATION_MESSAGE, deprecationLogger))); + } + + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpgradeStatusActionDeprecated.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpgradeStatusActionDeprecated.java index 1eb09b31ce26f..343788d38c11e 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpgradeStatusActionDeprecated.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpgradeStatusActionDeprecated.java @@ -26,12 +26,18 @@ import org.elasticsearch.common.Strings; import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import static java.util.Arrays.asList; +import static java.util.Collections.singletonList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.action.admin.indices.RestUpgradeActionDeprecated.UPGRADE_API_DEPRECATION_MESSAGE; @@ -40,11 +46,16 @@ public class RestUpgradeStatusActionDeprecated extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger( LogManager.getLogger(RestUpgradeStatusActionDeprecated.class)); - public RestUpgradeStatusActionDeprecated(RestController controller) { - controller.registerAsDeprecatedHandler(GET, "/_upgrade", this, - UPGRADE_API_DEPRECATION_MESSAGE, deprecationLogger); - controller.registerAsDeprecatedHandler(GET, "/{index}/_upgrade", this, - UPGRADE_API_DEPRECATION_MESSAGE, deprecationLogger); + @Override + public List deprecatedHandledMethodsAndPaths() { + return unmodifiableList(asList( + new DeprecatedRestApi("/_upgrade", singletonList(GET), UPGRADE_API_DEPRECATION_MESSAGE, deprecationLogger), + new DeprecatedRestApi("/{index}/_upgrade", singletonList(GET), UPGRADE_API_DEPRECATION_MESSAGE, deprecationLogger))); + } + + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestValidateQueryAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestValidateQueryAction.java index d176dad12e198..d9ab81a1d84fe 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestValidateQueryAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestValidateQueryAction.java @@ -26,28 +26,35 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.ParsingException; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestChannel; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestActions; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.RestStatus.OK; public class RestValidateQueryAction extends BaseRestHandler { - public RestValidateQueryAction(RestController controller) { - controller.registerHandler(GET, "/_validate/query", this); - controller.registerHandler(POST, "/_validate/query", this); - controller.registerHandler(GET, "/{index}/_validate/query", this); - controller.registerHandler(POST, "/{index}/_validate/query", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_validate/query", unmodifiableList(asList(GET, POST))) + .put("/{index}/_validate/query", unmodifiableList(asList(GET, POST))) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestAliasAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestAliasAction.java index 4fd43becf431b..137d11392d61a 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestAliasAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestAliasAction.java @@ -25,20 +25,27 @@ import org.elasticsearch.cluster.metadata.AliasMetaData; import org.elasticsearch.common.Strings; import org.elasticsearch.common.Table; -import org.elasticsearch.rest.RestController; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestResponseListener; +import java.util.Collections; import java.util.List; +import java.util.Map; +import static java.util.Collections.singletonList; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestAliasAction extends AbstractCatAction { - public RestAliasAction(RestController controller) { - controller.registerHandler(GET, "/_cat/aliases", this); - controller.registerHandler(GET, "/_cat/aliases/{alias}", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_cat/aliases", singletonList(GET)) + .put("/_cat/aliases/{alias}", singletonList(GET)) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestAllocationAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestAllocationAction.java index 1f30fb917ea24..e45ee833d708b 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestAllocationAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestAllocationAction.java @@ -31,21 +31,30 @@ import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.common.Strings; import org.elasticsearch.common.Table; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.unit.ByteSizeValue; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestActionListener; import org.elasticsearch.rest.action.RestResponseListener; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestAllocationAction extends AbstractCatAction { - public RestAllocationAction(RestController controller) { - controller.registerHandler(GET, "/_cat/allocation", this); - controller.registerHandler(GET, "/_cat/allocation/{nodes}", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_cat/allocation", singletonList(GET)) + .put("/_cat/allocation/{nodes}", singletonList(GET)) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestCatAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestCatAction.java index fe5f7b8127c5d..7b0a6f3bd4eef 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestCatAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestCatAction.java @@ -20,16 +20,18 @@ package org.elasticsearch.rest.action.cat; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.common.inject.Inject; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestStatus; import java.io.IOException; import java.util.List; +import java.util.Map; +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestCatAction extends BaseRestHandler { @@ -38,9 +40,7 @@ public class RestCatAction extends BaseRestHandler { private static final String CAT_NL = CAT + "\n"; private final String HELP; - @Inject - public RestCatAction(RestController controller, List catActions) { - controller.registerHandler(GET, "/_cat", this); + public RestCatAction(List catActions) { StringBuilder sb = new StringBuilder(); sb.append(CAT_NL); for (AbstractCatAction catAction : catActions) { @@ -49,6 +49,11 @@ public RestCatAction(RestController controller, List catActio HELP = sb.toString(); } + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_cat", singletonList(GET)); + } + @Override public String getName() { return "cat_action"; diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestCatRecoveryAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestCatRecoveryAction.java index d16e17e937ece..1334578da9336 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestCatRecoveryAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestCatRecoveryAction.java @@ -28,19 +28,23 @@ import org.elasticsearch.cluster.routing.RecoverySource.SnapshotRecoverySource; import org.elasticsearch.common.Strings; import org.elasticsearch.common.Table; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.XContentElasticsearchExtension; import org.elasticsearch.indices.recovery.RecoveryState; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestResponseListener; +import java.util.Collections; import java.util.Comparator; import java.util.List; import java.util.Locale; +import java.util.Map; +import static java.util.Collections.singletonList; import static org.elasticsearch.rest.RestRequest.Method.GET; /** @@ -50,9 +54,12 @@ */ public class RestCatRecoveryAction extends AbstractCatAction { - public RestCatRecoveryAction(RestController restController) { - restController.registerHandler(GET, "/_cat/recovery", this); - restController.registerHandler(GET, "/_cat/recovery/{index}", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_cat/recovery", singletonList(GET)) + .put("/_cat/recovery/{index}", singletonList(GET)) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestCountAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestCountAction.java index 7b7742972eac4..c90ceff03b466 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestCountAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestCountAction.java @@ -26,22 +26,31 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; import org.elasticsearch.common.Table; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.index.query.QueryBuilder; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestActions; import org.elasticsearch.rest.action.RestResponseListener; import org.elasticsearch.search.builder.SearchSourceBuilder; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import static java.util.Collections.singletonList; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestCountAction extends AbstractCatAction { - public RestCountAction(RestController restController) { - restController.registerHandler(GET, "/_cat/count", this); - restController.registerHandler(GET, "/_cat/count/{index}", this); + + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_cat/count", singletonList(GET)) + .put("/_cat/count/{index}", singletonList(GET)) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestFielddataAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestFielddataAction.java index 2eb83151953fc..11648e981adc1 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestFielddataAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestFielddataAction.java @@ -25,12 +25,18 @@ import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Table; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.unit.ByteSizeValue; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestResponseListener; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; import static org.elasticsearch.rest.RestRequest.Method.GET; /** @@ -38,9 +44,12 @@ */ public class RestFielddataAction extends AbstractCatAction { - public RestFielddataAction(RestController controller) { - controller.registerHandler(GET, "/_cat/fielddata", this); - controller.registerHandler(GET, "/_cat/fielddata/{fields}", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_cat/fielddata", singletonList(GET)) + .put("/_cat/fielddata/{fields}", singletonList(GET)) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestHealthAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestHealthAction.java index 5e896f210f665..eda3cf4290af0 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestHealthAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestHealthAction.java @@ -23,19 +23,24 @@ import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Table; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestResponseListener; +import java.util.List; import java.util.Locale; +import java.util.Map; +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestHealthAction extends AbstractCatAction { - public RestHealthAction(RestController controller) { - controller.registerHandler(GET, "/_cat/health", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_cat/health", singletonList(GET)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestIndicesAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestIndicesAction.java index 5a50b0ff04ce6..5cc7bfc70c455 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestIndicesAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestIndicesAction.java @@ -39,12 +39,13 @@ import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.Strings; import org.elasticsearch.common.Table; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.time.DateFormatter; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.index.IndexSettings; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestResponseListener; @@ -55,6 +56,7 @@ import java.util.Collection; import java.util.Collections; import java.util.HashSet; +import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Set; @@ -62,6 +64,7 @@ import java.util.stream.Collectors; import java.util.stream.StreamSupport; +import static java.util.Collections.singletonList; import static org.elasticsearch.action.support.master.MasterNodeRequest.DEFAULT_MASTER_NODE_TIMEOUT; import static org.elasticsearch.rest.RestRequest.Method.GET; @@ -69,9 +72,12 @@ public class RestIndicesAction extends AbstractCatAction { private static final DateFormatter STRICT_DATE_TIME_FORMATTER = DateFormatter.forPattern("strict_date_time"); - public RestIndicesAction(RestController controller) { - controller.registerHandler(GET, "/_cat/indices", this); - controller.registerHandler(GET, "/_cat/indices/{index}", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_cat/indices", singletonList(GET)) + .put("/_cat/indices/{index}", singletonList(GET)) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestMasterAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestMasterAction.java index e50865af019c6..68ba9c56e2864 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestMasterAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestMasterAction.java @@ -25,17 +25,23 @@ import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.common.Table; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestResponseListener; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestMasterAction extends AbstractCatAction { - public RestMasterAction(RestController controller) { - controller.registerHandler(GET, "/_cat/master", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_cat/master", singletonList(GET)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodeAttrsAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodeAttrsAction.java index efae10a6aa256..616d202ff3053 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodeAttrsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodeAttrsAction.java @@ -29,20 +29,24 @@ import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.common.Strings; import org.elasticsearch.common.Table; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestActionListener; import org.elasticsearch.rest.action.RestResponseListener; +import java.util.List; import java.util.Map; +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestNodeAttrsAction extends AbstractCatAction { - public RestNodeAttrsAction(RestController controller) { - controller.registerHandler(GET, "/_cat/nodeattrs", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_cat/nodeattrs", singletonList(GET)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodesAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodesAction.java index ac26c43385004..2bc8aab310d65 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodesAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodesAction.java @@ -54,23 +54,28 @@ import org.elasticsearch.monitor.jvm.JvmStats; import org.elasticsearch.monitor.os.OsStats; import org.elasticsearch.monitor.process.ProcessStats; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestActionListener; import org.elasticsearch.rest.action.RestResponseListener; import org.elasticsearch.script.ScriptStats; import org.elasticsearch.search.suggest.completion.CompletionStats; +import java.util.List; import java.util.Locale; +import java.util.Map; import java.util.stream.Collectors; +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestNodesAction extends AbstractCatAction { - public RestNodesAction(RestController controller) { - controller.registerHandler(GET, "/_cat/nodes", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_cat/nodes", singletonList(GET)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestPendingClusterTasksAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestPendingClusterTasksAction.java index 84bd87981536b..20e26833fda3f 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestPendingClusterTasksAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestPendingClusterTasksAction.java @@ -24,17 +24,23 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.cluster.service.PendingClusterTask; import org.elasticsearch.common.Table; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestResponseListener; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestPendingClusterTasksAction extends AbstractCatAction { - public RestPendingClusterTasksAction(RestController controller) { - controller.registerHandler(GET, "/_cat/pending_tasks", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_cat/pending_tasks", singletonList(GET)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestPluginsAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestPluginsAction.java index eb6a6fc4b8ff8..6b5a18b09c293 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestPluginsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestPluginsAction.java @@ -29,18 +29,24 @@ import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.common.Table; import org.elasticsearch.plugins.PluginInfo; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestActionListener; import org.elasticsearch.rest.action.RestResponseListener; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestPluginsAction extends AbstractCatAction { - public RestPluginsAction(RestController controller) { - controller.registerHandler(GET, "/_cat/plugins", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_cat/plugins", singletonList(GET)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestRepositoriesAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestRepositoriesAction.java index f77f9bf100bda..746260e51c5ad 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestRepositoriesAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestRepositoriesAction.java @@ -24,11 +24,16 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.cluster.metadata.RepositoryMetaData; import org.elasticsearch.common.Table; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestResponseListener; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; /** @@ -36,8 +41,9 @@ */ public class RestRepositoriesAction extends AbstractCatAction { - public RestRepositoriesAction(RestController controller) { - controller.registerHandler(GET, "/_cat/repositories", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_cat/repositories", singletonList(GET)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestSegmentsAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestSegmentsAction.java index c51fa593f3b5f..5536b1b66c07e 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestSegmentsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestSegmentsAction.java @@ -30,23 +30,29 @@ import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.common.Strings; import org.elasticsearch.common.Table; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.index.engine.Segment; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestActionListener; import org.elasticsearch.rest.action.RestResponseListener; +import java.util.Collections; import java.util.List; import java.util.Map; +import static java.util.Collections.singletonList; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestSegmentsAction extends AbstractCatAction { - public RestSegmentsAction(RestController controller) { - controller.registerHandler(GET, "/_cat/segments", this); - controller.registerHandler(GET, "/_cat/segments/{index}", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_cat/segments", singletonList(GET)) + .put("/_cat/segments/{index}", singletonList(GET)) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestShardsAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestShardsAction.java index 847b1a773e52a..6cd8d02abb447 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestShardsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestShardsAction.java @@ -30,6 +30,7 @@ import org.elasticsearch.cluster.routing.UnassignedInfo; import org.elasticsearch.common.Strings; import org.elasticsearch.common.Table; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.index.cache.query.QueryCacheStats; import org.elasticsearch.index.engine.CommitStats; @@ -45,24 +46,31 @@ import org.elasticsearch.index.shard.DocsStats; import org.elasticsearch.index.store.StoreStats; import org.elasticsearch.index.warmer.WarmerStats; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestActionListener; import org.elasticsearch.rest.action.RestResponseListener; import org.elasticsearch.search.suggest.completion.CompletionStats; import java.time.Instant; +import java.util.Collections; +import java.util.List; import java.util.Locale; +import java.util.Map; import java.util.function.Function; +import static java.util.Collections.singletonList; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestShardsAction extends AbstractCatAction { - public RestShardsAction(RestController controller) { - controller.registerHandler(GET, "/_cat/shards", this); - controller.registerHandler(GET, "/_cat/shards/{index}", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_cat/shards", singletonList(GET)) + .put("/_cat/shards/{index}", singletonList(GET)) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestSnapshotAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestSnapshotAction.java index 94361b90eb8c4..a881c027bbd1d 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestSnapshotAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestSnapshotAction.java @@ -26,10 +26,11 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; import org.elasticsearch.common.Table; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.time.DateFormatter; import org.elasticsearch.common.unit.TimeValue; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestResponseListener; import org.elasticsearch.snapshots.SnapshotInfo; @@ -37,10 +38,12 @@ import java.time.Instant; import java.time.ZoneOffset; +import java.util.Collections; import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; +import static java.util.Collections.singletonList; import static org.elasticsearch.rest.RestRequest.Method.GET; /** @@ -48,9 +51,12 @@ */ public class RestSnapshotAction extends AbstractCatAction { - public RestSnapshotAction(RestController controller) { - controller.registerHandler(GET, "/_cat/snapshots", this); - controller.registerHandler(GET, "/_cat/snapshots/{repository}", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_cat/snapshots", singletonList(GET)) + .put("/_cat/snapshots/{repository}", singletonList(GET)) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestTasksAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestTasksAction.java index b6d5eb549bfa4..e635a496f7e18 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestTasksAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestTasksAction.java @@ -28,8 +28,8 @@ import org.elasticsearch.common.Table; import org.elasticsearch.common.time.DateFormatter; import org.elasticsearch.common.unit.TimeValue; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestResponseListener; import org.elasticsearch.tasks.TaskInfo; @@ -41,20 +41,27 @@ import java.util.Comparator; import java.util.HashSet; import java.util.List; +import java.util.Map; import java.util.Set; import java.util.function.Supplier; +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.action.admin.cluster.RestListTasksAction.generateListTasksRequest; public class RestTasksAction extends AbstractCatAction { private final Supplier nodesInCluster; - public RestTasksAction(RestController controller, Supplier nodesInCluster) { - controller.registerHandler(GET, "/_cat/tasks", this); + public RestTasksAction(Supplier nodesInCluster) { this.nodesInCluster = nodesInCluster; } + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_cat/tasks", singletonList(GET)); + } + @Override public String getName() { return "cat_tasks_action"; diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestTemplatesAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestTemplatesAction.java index c8da4648e2ac0..d958e99bbd75e 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestTemplatesAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestTemplatesAction.java @@ -26,19 +26,28 @@ import org.elasticsearch.cluster.metadata.IndexTemplateMetaData; import org.elasticsearch.cluster.metadata.MetaData; import org.elasticsearch.common.Table; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.regex.Regex; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestResponseListener; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestTemplatesAction extends AbstractCatAction { - public RestTemplatesAction(RestController controller) { - controller.registerHandler(GET, "/_cat/templates", this); - controller.registerHandler(GET, "/_cat/templates/{name}", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_cat/templates", singletonList(GET)) + .put("/_cat/templates/{name}", singletonList(GET)) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestThreadPoolAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestThreadPoolAction.java index 571767affd0c0..606ed22bc1cb2 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestThreadPoolAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestThreadPoolAction.java @@ -31,9 +31,10 @@ import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.common.Table; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.regex.Regex; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestActionListener; import org.elasticsearch.rest.action.RestResponseListener; @@ -43,17 +44,22 @@ import java.util.Collections; import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; import java.util.Set; import java.util.TreeMap; +import static java.util.Collections.singletonList; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestThreadPoolAction extends AbstractCatAction { - public RestThreadPoolAction(RestController controller) { - controller.registerHandler(GET, "/_cat/thread_pool", this); - controller.registerHandler(GET, "/_cat/thread_pool/{thread_pool_patterns}", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_cat/thread_pool", singletonList(GET)) + .put("/_cat/thread_pool/{thread_pool_patterns}", singletonList(GET)) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/document/RestBulkAction.java b/server/src/main/java/org/elasticsearch/rest/action/document/RestBulkAction.java index db925cd663ff9..adb91d60e7eb7 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/document/RestBulkAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/document/RestBulkAction.java @@ -24,15 +24,21 @@ import org.elasticsearch.action.support.ActiveShardCount; import org.elasticsearch.client.Requests; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestStatusToXContentListener; import org.elasticsearch.search.fetch.subphase.FetchSourceContext; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.RestRequest.Method.PUT; @@ -49,15 +55,18 @@ public class RestBulkAction extends BaseRestHandler { private final boolean allowExplicitIndex; - public RestBulkAction(Settings settings, RestController controller) { - controller.registerHandler(POST, "/_bulk", this); - controller.registerHandler(PUT, "/_bulk", this); - controller.registerHandler(POST, "/{index}/_bulk", this); - controller.registerHandler(PUT, "/{index}/_bulk", this); - + public RestBulkAction(Settings settings) { this.allowExplicitIndex = MULTI_ALLOW_EXPLICIT_INDEX.get(settings); } + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_bulk", unmodifiableList(asList(POST, PUT))) + .put("/{index}/_bulk", unmodifiableList(asList(POST, PUT))) + .map()); + } + @Override public String getName() { return "bulk_action"; diff --git a/server/src/main/java/org/elasticsearch/rest/action/document/RestDeleteAction.java b/server/src/main/java/org/elasticsearch/rest/action/document/RestDeleteAction.java index bf7cd0d8da6e4..6942d9fe05693 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/document/RestDeleteAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/document/RestDeleteAction.java @@ -24,19 +24,24 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.index.VersionType; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestActions; import org.elasticsearch.rest.action.RestStatusToXContentListener; import java.io.IOException; +import java.util.List; +import java.util.Map; +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.DELETE; public class RestDeleteAction extends BaseRestHandler { - public RestDeleteAction(RestController controller) { - controller.registerHandler(DELETE, "/{index}/_doc/{id}", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/{index}/_doc/{id}", singletonList(DELETE)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/document/RestGetAction.java b/server/src/main/java/org/elasticsearch/rest/action/document/RestGetAction.java index d90431d2c0cdb..5252baa3af064 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/document/RestGetAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/document/RestGetAction.java @@ -23,17 +23,23 @@ import org.elasticsearch.action.get.GetResponse; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.index.VersionType; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestActions; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.search.fetch.subphase.FetchSourceContext; import java.io.IOException; +import java.util.List; +import java.util.Map; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; +import static java.util.Collections.unmodifiableMap; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.HEAD; import static org.elasticsearch.rest.RestStatus.NOT_FOUND; @@ -41,16 +47,18 @@ public class RestGetAction extends BaseRestHandler { - public RestGetAction(final RestController controller) { - controller.registerHandler(GET, "/{index}/_doc/{id}", this); - controller.registerHandler(HEAD, "/{index}/_doc/{id}", this); - } - @Override public String getName() { return "document_get_action"; } + @Override + public Map> handledMethodsAndPaths() { + return unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/{index}/_doc/{id}", unmodifiableList(asList(GET, HEAD))) + .map()); + } + @Override public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException { GetRequest getRequest = new GetRequest(request.param("index"), request.param("id")); diff --git a/server/src/main/java/org/elasticsearch/rest/action/document/RestGetSourceAction.java b/server/src/main/java/org/elasticsearch/rest/action/document/RestGetSourceAction.java index c9cb5a5fb0f5e..f974d7328a70d 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/document/RestGetSourceAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/document/RestGetSourceAction.java @@ -30,15 +30,20 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestChannel; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestResponseListener; import org.elasticsearch.search.fetch.subphase.FetchSourceContext; import java.io.IOException; import java.io.InputStream; +import java.util.List; +import java.util.Map; +import static java.util.Arrays.asList; +import static java.util.Collections.singletonMap; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.HEAD; import static org.elasticsearch.rest.RestStatus.OK; @@ -48,9 +53,9 @@ */ public class RestGetSourceAction extends BaseRestHandler { - public RestGetSourceAction(final RestController controller) { - controller.registerHandler(GET, "/{index}/_source/{id}", this); - controller.registerHandler(HEAD, "/{index}/_source/{id}", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/{index}/_source/{id}", unmodifiableList(asList(GET, HEAD))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/document/RestIndexAction.java b/server/src/main/java/org/elasticsearch/rest/action/document/RestIndexAction.java index 03ae85e380e82..a193afea2b37e 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/document/RestIndexAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/document/RestIndexAction.java @@ -26,32 +26,28 @@ import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.index.VersionType; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestActions; import org.elasticsearch.rest.action.RestStatusToXContentListener; import java.io.IOException; +import java.util.List; import java.util.Locale; +import java.util.Map; +import static java.util.Arrays.asList; +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.RestRequest.Method.PUT; public class RestIndexAction extends BaseRestHandler { - private final ClusterService clusterService; - - public RestIndexAction(RestController controller, ClusterService clusterService) { - this.clusterService = clusterService; - - AutoIdHandler autoIdHandler = new AutoIdHandler(); - controller.registerHandler(POST, "/{index}/_doc", autoIdHandler); // auto id creation - controller.registerHandler(PUT, "/{index}/_doc/{id}", this); - controller.registerHandler(POST, "/{index}/_doc/{id}", this); - - CreateHandler createHandler = new CreateHandler(); - controller.registerHandler(PUT, "/{index}/_create/{id}", createHandler); - controller.registerHandler(POST, "/{index}/_create/{id}/", createHandler); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/{index}/_doc/{id}", unmodifiableList(asList(POST, PUT))); } @Override @@ -59,20 +55,23 @@ public String getName() { return "document_index_action"; } - final class CreateHandler extends BaseRestHandler { - protected CreateHandler() { - } + public static final class CreateHandler extends RestIndexAction { @Override public String getName() { return "document_create_action"; } + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/{index}/_create/{id}", unmodifiableList(asList(POST, PUT))); + } + @Override public RestChannelConsumer prepareRequest(RestRequest request, final NodeClient client) throws IOException { validateOpType(request.params().get("op_type")); request.params().put("op_type", "create"); - return RestIndexAction.this.prepareRequest(request, client); + return super.prepareRequest(request, client); } void validateOpType(String opType) { @@ -82,8 +81,12 @@ void validateOpType(String opType) { } } - final class AutoIdHandler extends BaseRestHandler { - protected AutoIdHandler() { + public static final class AutoIdHandler extends RestIndexAction { + + private final ClusterService clusterService; + + public AutoIdHandler(ClusterService clusterService) { + this.clusterService = clusterService; } @Override @@ -91,6 +94,11 @@ public String getName() { return "document_create_action"; } + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/{index}/_doc", singletonList(POST)); + } + @Override public RestChannelConsumer prepareRequest(RestRequest request, final NodeClient client) throws IOException { assert request.params().get("id") == null : "non-null id: " + request.params().get("id"); @@ -98,7 +106,7 @@ public RestChannelConsumer prepareRequest(RestRequest request, final NodeClient // default to op_type create request.params().put("op_type", "create"); } - return RestIndexAction.this.prepareRequest(request, client); + return super.prepareRequest(request, client); } } diff --git a/server/src/main/java/org/elasticsearch/rest/action/document/RestMultiGetAction.java b/server/src/main/java/org/elasticsearch/rest/action/document/RestMultiGetAction.java index 7b1cb4aaaeba5..74c3749f32797 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/document/RestMultiGetAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/document/RestMultiGetAction.java @@ -22,16 +22,22 @@ import org.elasticsearch.action.get.MultiGetRequest; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.search.fetch.subphase.FetchSourceContext; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -39,15 +45,18 @@ public class RestMultiGetAction extends BaseRestHandler { private final boolean allowExplicitIndex; - public RestMultiGetAction(Settings settings, RestController controller) { - controller.registerHandler(GET, "/_mget", this); - controller.registerHandler(POST, "/_mget", this); - controller.registerHandler(GET, "/{index}/_mget", this); - controller.registerHandler(POST, "/{index}/_mget", this); - + public RestMultiGetAction(Settings settings) { this.allowExplicitIndex = MULTI_ALLOW_EXPLICIT_INDEX.get(settings); } + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_mget", unmodifiableList(asList(GET, POST))) + .put("/{index}/_mget", unmodifiableList(asList(GET, POST))) + .map()); + } + @Override public String getName() { return "document_mget_action"; diff --git a/server/src/main/java/org/elasticsearch/rest/action/document/RestMultiTermVectorsAction.java b/server/src/main/java/org/elasticsearch/rest/action/document/RestMultiTermVectorsAction.java index 8d1b6c96b1d47..d374f2fb553cc 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/document/RestMultiTermVectorsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/document/RestMultiTermVectorsAction.java @@ -23,23 +23,30 @@ import org.elasticsearch.action.termvectors.TermVectorsRequest; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestMultiTermVectorsAction extends BaseRestHandler { - public RestMultiTermVectorsAction(RestController controller) { - controller.registerHandler(GET, "/_mtermvectors", this); - controller.registerHandler(POST, "/_mtermvectors", this); - controller.registerHandler(GET, "/{index}/_mtermvectors", this); - controller.registerHandler(POST, "/{index}/_mtermvectors", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_mtermvectors", unmodifiableList(asList(GET, POST))) + .put("/{index}/_mtermvectors", unmodifiableList(asList(GET, POST))) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/document/RestTermVectorsAction.java b/server/src/main/java/org/elasticsearch/rest/action/document/RestTermVectorsAction.java index 66afda4879e35..28cc5f66e4b22 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/document/RestTermVectorsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/document/RestTermVectorsAction.java @@ -22,18 +22,24 @@ import org.elasticsearch.action.termvectors.TermVectorsRequest; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.index.VersionType; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestActions; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.Collections; import java.util.HashSet; +import java.util.List; +import java.util.Map; import java.util.Set; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -43,11 +49,12 @@ */ public class RestTermVectorsAction extends BaseRestHandler { - public RestTermVectorsAction(RestController controller) { - controller.registerHandler(GET, "/{index}/_termvectors", this); - controller.registerHandler(POST, "/{index}/_termvectors", this); - controller.registerHandler(GET, "/{index}/_termvectors/{id}", this); - controller.registerHandler(POST, "/{index}/_termvectors/{id}", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/{index}/_termvectors", unmodifiableList(asList(GET, POST))) + .put("/{index}/_termvectors/{id}", unmodifiableList(asList(GET, POST))) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/document/RestUpdateAction.java b/server/src/main/java/org/elasticsearch/rest/action/document/RestUpdateAction.java index 82bcf1ffbaedb..bbba97aaf238d 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/document/RestUpdateAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/document/RestUpdateAction.java @@ -26,20 +26,25 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.index.VersionType; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestActions; import org.elasticsearch.rest.action.RestStatusToXContentListener; import org.elasticsearch.search.fetch.subphase.FetchSourceContext; import java.io.IOException; +import java.util.List; +import java.util.Map; +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestUpdateAction extends BaseRestHandler { - public RestUpdateAction(RestController controller) { - controller.registerHandler(POST, "/{index}/_update/{id}", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/{index}/_update/{id}", singletonList(POST)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/ingest/RestDeletePipelineAction.java b/server/src/main/java/org/elasticsearch/rest/action/ingest/RestDeletePipelineAction.java index dea61df609a92..b7d7b64893790 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/ingest/RestDeletePipelineAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/ingest/RestDeletePipelineAction.java @@ -22,15 +22,22 @@ import org.elasticsearch.action.ingest.DeletePipelineRequest; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.DELETE; public class RestDeletePipelineAction extends BaseRestHandler { - public RestDeletePipelineAction(RestController controller) { - controller.registerHandler(RestRequest.Method.DELETE, "/_ingest/pipeline/{id}", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_ingest/pipeline/{id}", singletonList(DELETE)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/ingest/RestGetPipelineAction.java b/server/src/main/java/org/elasticsearch/rest/action/ingest/RestGetPipelineAction.java index 751b9ee68894a..ac35a9d2a383b 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/ingest/RestGetPipelineAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/ingest/RestGetPipelineAction.java @@ -22,18 +22,28 @@ import org.elasticsearch.action.ingest.GetPipelineRequest; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestStatusToXContentListener; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestGetPipelineAction extends BaseRestHandler { - public RestGetPipelineAction(RestController controller) { - controller.registerHandler(RestRequest.Method.GET, "/_ingest/pipeline", this); - controller.registerHandler(RestRequest.Method.GET, "/_ingest/pipeline/{id}", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_ingest/pipeline", singletonList(GET)) + .put("/_ingest/pipeline/{id}", singletonList(GET)) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/ingest/RestPutPipelineAction.java b/server/src/main/java/org/elasticsearch/rest/action/ingest/RestPutPipelineAction.java index 3b1861c14f591..d150a090bee35 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/ingest/RestPutPipelineAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/ingest/RestPutPipelineAction.java @@ -25,17 +25,24 @@ import org.elasticsearch.common.collect.Tuple; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.PUT; public class RestPutPipelineAction extends BaseRestHandler { - public RestPutPipelineAction(RestController controller) { - controller.registerHandler(RestRequest.Method.PUT, "/_ingest/pipeline/{id}", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_ingest/pipeline/{id}", singletonList(PUT)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/ingest/RestSimulatePipelineAction.java b/server/src/main/java/org/elasticsearch/rest/action/ingest/RestSimulatePipelineAction.java index 6b8d6c3ccc4cd..01a11658ab7f8 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/ingest/RestSimulatePipelineAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/ingest/RestSimulatePipelineAction.java @@ -22,22 +22,32 @@ import org.elasticsearch.action.ingest.SimulatePipelineRequest; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.bytes.BytesReference; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.collect.Tuple; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; +import static org.elasticsearch.rest.RestRequest.Method.GET; +import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestSimulatePipelineAction extends BaseRestHandler { - public RestSimulatePipelineAction(RestController controller) { - controller.registerHandler(RestRequest.Method.POST, "/_ingest/pipeline/{id}/_simulate", this); - controller.registerHandler(RestRequest.Method.GET, "/_ingest/pipeline/{id}/_simulate", this); - controller.registerHandler(RestRequest.Method.POST, "/_ingest/pipeline/_simulate", this); - controller.registerHandler(RestRequest.Method.GET, "/_ingest/pipeline/_simulate", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_ingest/pipeline/{id}/_simulate", unmodifiableList(asList(GET, POST))) + .put("/_ingest/pipeline/_simulate", unmodifiableList(asList(GET, POST))) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/search/RestClearScrollAction.java b/server/src/main/java/org/elasticsearch/rest/action/search/RestClearScrollAction.java index a8c69867a57fd..901f333d2d27d 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/search/RestClearScrollAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/search/RestClearScrollAction.java @@ -22,20 +22,29 @@ import org.elasticsearch.action.search.ClearScrollRequest; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestStatusToXContentListener; import java.io.IOException; import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import static java.util.Collections.singletonList; import static org.elasticsearch.rest.RestRequest.Method.DELETE; public class RestClearScrollAction extends BaseRestHandler { - public RestClearScrollAction(RestController controller) { - controller.registerHandler(DELETE, "/_search/scroll", this); - controller.registerHandler(DELETE, "/_search/scroll/{scroll_id}", this); + + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_search/scroll", singletonList(DELETE)) + .put("/_search/scroll/{scroll_id}", singletonList(DELETE)) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/search/RestCountAction.java b/server/src/main/java/org/elasticsearch/rest/action/search/RestCountAction.java index bed40bffd5e8e..4971bd4171304 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/search/RestCountAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/search/RestCountAction.java @@ -24,19 +24,25 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestActions; import org.elasticsearch.rest.action.RestBuilderListener; import org.elasticsearch.search.builder.SearchSourceBuilder; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.action.RestActions.buildBroadcastShardsHeader; @@ -44,11 +50,12 @@ public class RestCountAction extends BaseRestHandler { - public RestCountAction(RestController controller) { - controller.registerHandler(POST, "/_count", this); - controller.registerHandler(GET, "/_count", this); - controller.registerHandler(POST, "/{index}/_count", this); - controller.registerHandler(GET, "/{index}/_count", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_count", unmodifiableList(asList(GET, POST))) + .put("/{index}/_count", unmodifiableList(asList(GET, POST))) + .map()); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/search/RestExplainAction.java b/server/src/main/java/org/elasticsearch/rest/action/search/RestExplainAction.java index 5613540edad8e..bff63b596d33b 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/search/RestExplainAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/search/RestExplainAction.java @@ -24,14 +24,19 @@ import org.elasticsearch.common.Strings; import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestActions; import org.elasticsearch.rest.action.RestStatusToXContentListener; import org.elasticsearch.search.fetch.subphase.FetchSourceContext; import java.io.IOException; +import java.util.List; +import java.util.Map; +import static java.util.Arrays.asList; +import static java.util.Collections.singletonMap; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -40,9 +45,9 @@ */ public class RestExplainAction extends BaseRestHandler { - public RestExplainAction(RestController controller) { - controller.registerHandler(GET, "/{index}/_explain/{id}", this); - controller.registerHandler(POST, "/{index}/_explain/{id}", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/{index}/_explain/{id}", unmodifiableList(asList(GET, POST))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/search/RestMultiSearchAction.java b/server/src/main/java/org/elasticsearch/rest/action/search/RestMultiSearchAction.java index e0752d41926a8..319ffba16a7f0 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/search/RestMultiSearchAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/search/RestMultiSearchAction.java @@ -26,14 +26,15 @@ import org.elasticsearch.common.CheckedBiConsumer; import org.elasticsearch.common.Strings; import org.elasticsearch.common.bytes.BytesReference; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.collect.Tuple; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContent; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.search.builder.SearchSourceBuilder; @@ -42,8 +43,11 @@ import java.util.Collections; import java.util.HashSet; import java.util.List; +import java.util.Map; import java.util.Set; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -60,15 +64,18 @@ public class RestMultiSearchAction extends BaseRestHandler { private final boolean allowExplicitIndex; - public RestMultiSearchAction(Settings settings, RestController controller) { - controller.registerHandler(GET, "/_msearch", this); - controller.registerHandler(POST, "/_msearch", this); - controller.registerHandler(GET, "/{index}/_msearch", this); - controller.registerHandler(POST, "/{index}/_msearch", this); - + public RestMultiSearchAction(Settings settings) { this.allowExplicitIndex = MULTI_ALLOW_EXPLICIT_INDEX.get(settings); } + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_msearch", unmodifiableList(asList(GET, POST))) + .put("/{index}/_msearch", unmodifiableList(asList(GET, POST))) + .map()); + } + @Override public String getName() { return "msearch_action"; diff --git a/server/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java b/server/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java index 5bdc0f3fffadf..1dde750859fae 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java @@ -25,11 +25,12 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Booleans; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestActions; import org.elasticsearch.rest.action.RestCancellableNodeClient; import org.elasticsearch.rest.action.RestStatusToXContentListener; @@ -46,9 +47,13 @@ import java.util.Arrays; import java.util.Collections; import java.util.HashSet; +import java.util.List; +import java.util.Map; import java.util.Set; import java.util.function.IntConsumer; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.common.unit.TimeValue.parseTimeValue; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -68,18 +73,19 @@ public class RestSearchAction extends BaseRestHandler { RESPONSE_PARAMS = Collections.unmodifiableSet(responseParams); } - public RestSearchAction(RestController controller) { - controller.registerHandler(GET, "/_search", this); - controller.registerHandler(POST, "/_search", this); - controller.registerHandler(GET, "/{index}/_search", this); - controller.registerHandler(POST, "/{index}/_search", this); - } - @Override public String getName() { return "search_action"; } + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_search", unmodifiableList(asList(GET, POST))) + .put("/{index}/_search", unmodifiableList(asList(GET, POST))) + .map()); + } + @Override public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException { SearchRequest searchRequest = new SearchRequest(); diff --git a/server/src/main/java/org/elasticsearch/rest/action/search/RestSearchScrollAction.java b/server/src/main/java/org/elasticsearch/rest/action/search/RestSearchScrollAction.java index 0b49048dee906..ad12bd5f0a800 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/search/RestSearchScrollAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/search/RestSearchScrollAction.java @@ -21,16 +21,21 @@ import org.elasticsearch.action.search.SearchScrollRequest; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestStatusToXContentListener; import org.elasticsearch.search.Scroll; import java.io.IOException; import java.util.Collections; +import java.util.List; +import java.util.Map; import java.util.Set; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.common.unit.TimeValue.parseTimeValue; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -38,18 +43,19 @@ public class RestSearchScrollAction extends BaseRestHandler { private static final Set RESPONSE_PARAMS = Collections.singleton(RestSearchAction.TOTAL_HITS_AS_INT_PARAM); - public RestSearchScrollAction(RestController controller) { - controller.registerHandler(GET, "/_search/scroll", this); - controller.registerHandler(POST, "/_search/scroll", this); - controller.registerHandler(GET, "/_search/scroll/{scroll_id}", this); - controller.registerHandler(POST, "/_search/scroll/{scroll_id}", this); - } - @Override public String getName() { return "search_scroll_action"; } + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_search/scroll", unmodifiableList(asList(GET, POST))) + .put("/_search/scroll/{scroll_id}", unmodifiableList(asList(GET, POST))) + .map()); + } + @Override public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException { String scrollId = request.param("scroll_id"); diff --git a/server/src/test/java/org/elasticsearch/action/ActionModuleTests.java b/server/src/test/java/org/elasticsearch/action/ActionModuleTests.java index df0c77c96ea19..189583f6de33b 100644 --- a/server/src/test/java/org/elasticsearch/action/ActionModuleTests.java +++ b/server/src/test/java/org/elasticsearch/action/ActionModuleTests.java @@ -47,7 +47,9 @@ import org.elasticsearch.usage.UsageService; import java.io.IOException; +import java.util.Collections; import java.util.List; +import java.util.Map; import java.util.function.Supplier; import static java.util.Collections.emptyList; @@ -113,7 +115,16 @@ public void testSetupRestHandlerContainsKnownBuiltin() { actionModule.initRestHandlers(null); // At this point the easiest way to confirm that a handler is loaded is to try to register another one on top of it and to fail Exception e = expectThrows(IllegalArgumentException.class, () -> - actionModule.getRestController().registerHandler(Method.GET, "/", null)); + actionModule.getRestController().registerHandler(new RestHandler() { + @Override + public void handleRequest(RestRequest request, RestChannel channel, NodeClient client) throws Exception { + } + + @Override + public Map> handledMethodsAndPaths() { + return Collections.singletonMap("/", singletonList(Method.GET)); + } + })); assertThat(e.getMessage(), startsWith("Cannot replace existing handler for [/] for method: GET")); } @@ -123,7 +134,7 @@ public void testPluginCantOverwriteBuiltinRestHandler() throws IOException { public List getRestHandlers(Settings settings, RestController restController, ClusterSettings clusterSettings, IndexScopedSettings indexScopedSettings, SettingsFilter settingsFilter, IndexNameExpressionResolver indexNameExpressionResolver, Supplier nodesInCluster) { - return singletonList(new RestMainAction(restController)); + return singletonList(new RestMainAction()); } }; SettingsModule settings = new SettingsModule(Settings.EMPTY); @@ -142,9 +153,11 @@ public List getRestHandlers(Settings settings, RestController restC public void testPluginCanRegisterRestHandler() { class FakeHandler implements RestHandler { - FakeHandler(RestController restController) { - restController.registerHandler(Method.GET, "/_dummy", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.singletonMap("/_dummy", singletonList(Method.GET)); } + @Override public void handleRequest(RestRequest request, RestChannel channel, NodeClient client) throws Exception { } @@ -154,7 +167,7 @@ public void handleRequest(RestRequest request, RestChannel channel, NodeClient c public List getRestHandlers(Settings settings, RestController restController, ClusterSettings clusterSettings, IndexScopedSettings indexScopedSettings, SettingsFilter settingsFilter, IndexNameExpressionResolver indexNameExpressionResolver, Supplier nodesInCluster) { - return singletonList(new FakeHandler(restController)); + return singletonList(new FakeHandler()); } }; @@ -168,7 +181,16 @@ public List getRestHandlers(Settings settings, RestController restC actionModule.initRestHandlers(null); // At this point the easiest way to confirm that a handler is loaded is to try to register another one on top of it and to fail Exception e = expectThrows(IllegalArgumentException.class, () -> - actionModule.getRestController().registerHandler(Method.GET, "/_dummy", null)); + actionModule.getRestController().registerHandler(new RestHandler() { + @Override + public void handleRequest(RestRequest request, RestChannel channel, NodeClient client) throws Exception { + } + + @Override + public Map> handledMethodsAndPaths() { + return Collections.singletonMap("/_dummy", singletonList(Method.GET)); + } + })); assertThat(e.getMessage(), startsWith("Cannot replace existing handler for [/_dummy] for method: GET")); } finally { threadPool.shutdown(); diff --git a/server/src/test/java/org/elasticsearch/action/admin/indices/forcemerge/RestForceMergeActionTests.java b/server/src/test/java/org/elasticsearch/action/admin/indices/forcemerge/RestForceMergeActionTests.java index 919b3935a7f45..322b8a61fcce3 100644 --- a/server/src/test/java/org/elasticsearch/action/admin/indices/forcemerge/RestForceMergeActionTests.java +++ b/server/src/test/java/org/elasticsearch/action/admin/indices/forcemerge/RestForceMergeActionTests.java @@ -44,7 +44,7 @@ public class RestForceMergeActionTests extends RestActionTestCase { @Before public void setUpAction() { - new RestForceMergeAction(controller()); + controller().registerHandler(new RestForceMergeAction()); } public void testBodyRejection() throws Exception { diff --git a/server/src/test/java/org/elasticsearch/rest/BaseRestHandlerTests.java b/server/src/test/java/org/elasticsearch/rest/BaseRestHandlerTests.java index 66badef0cefc5..7391aab78ee85 100644 --- a/server/src/test/java/org/elasticsearch/rest/BaseRestHandlerTests.java +++ b/server/src/test/java/org/elasticsearch/rest/BaseRestHandlerTests.java @@ -25,6 +25,7 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.common.xcontent.json.JsonXContent; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.cat.AbstractCatAction; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.rest.FakeRestChannel; @@ -33,6 +34,8 @@ import java.io.IOException; import java.util.Collections; import java.util.HashMap; +import java.util.List; +import java.util.Map; import java.util.Set; import java.util.concurrent.atomic.AtomicBoolean; @@ -55,6 +58,11 @@ protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient cli public String getName() { return "test_one_unconsumed_response_action"; } + + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } }; final HashMap params = new HashMap<>(); @@ -81,6 +89,11 @@ protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient cli public String getName() { return "test_multiple_unconsumed_response_action"; } + + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } }; final HashMap params = new HashMap<>(); @@ -117,6 +130,11 @@ protected Set responseParams() { public String getName() { return "test_unconsumed_did_you_mean_response_action"; } + + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } }; final HashMap params = new HashMap<>(); @@ -160,6 +178,11 @@ protected Set responseParams() { public String getName() { return "test_unconsumed_response_action"; } + + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } }; final HashMap params = new HashMap<>(); @@ -183,6 +206,11 @@ protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient cli public String getName() { return "test_default_response_action"; } + + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } }; final HashMap params = new HashMap<>(); @@ -218,6 +246,11 @@ protected Table getTableWithHeader(RestRequest request) { public String getName() { return "test_cat_response_action"; } + + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } }; final HashMap params = new HashMap<>(); @@ -249,6 +282,10 @@ public String getName() { return "test_consumed_body"; } + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } }; try (XContentBuilder builder = JsonXContent.contentBuilder().startObject().endObject()) { @@ -274,6 +311,10 @@ public String getName() { return "test_unconsumed_body"; } + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } }; final RestRequest request = new FakeRestRequest.Builder(xContentRegistry()).build(); @@ -295,6 +336,10 @@ public String getName() { return "test_unconsumed_body"; } + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } }; try (XContentBuilder builder = JsonXContent.contentBuilder().startObject().endObject()) { diff --git a/server/src/test/java/org/elasticsearch/rest/RestControllerTests.java b/server/src/test/java/org/elasticsearch/rest/RestControllerTests.java index 8413864d2ea26..994d2b0adbd7d 100644 --- a/server/src/test/java/org/elasticsearch/rest/RestControllerTests.java +++ b/server/src/test/java/org/elasticsearch/rest/RestControllerTests.java @@ -250,27 +250,6 @@ public void testRestHandlerWrapper() throws Exception { assertFalse(handlerCalled.get()); } - /** - * Useful for testing with deprecation handler. - */ - private static class FakeRestHandler implements RestHandler { - private final boolean canTripCircuitBreaker; - - private FakeRestHandler(boolean canTripCircuitBreaker) { - this.canTripCircuitBreaker = canTripCircuitBreaker; - } - - @Override - public void handleRequest(RestRequest request, RestChannel channel, NodeClient client) throws Exception { - //no op - } - - @Override - public boolean canTripCircuitBreaker() { - return canTripCircuitBreaker; - } - } - public void testDispatchRequestAddsAndFreesBytesOnSuccess() { int contentLength = BREAKER_LIMIT.bytesAsInt(); String content = randomAlphaOfLength((int) Math.round(contentLength / inFlightRequestsBreaker.getOverhead())); diff --git a/server/src/test/java/org/elasticsearch/rest/action/admin/cluster/RestAddVotingConfigExclusionActionTests.java b/server/src/test/java/org/elasticsearch/rest/action/admin/cluster/RestAddVotingConfigExclusionActionTests.java index c686497922346..538c57b035e01 100644 --- a/server/src/test/java/org/elasticsearch/rest/action/admin/cluster/RestAddVotingConfigExclusionActionTests.java +++ b/server/src/test/java/org/elasticsearch/rest/action/admin/cluster/RestAddVotingConfigExclusionActionTests.java @@ -34,7 +34,8 @@ public class RestAddVotingConfigExclusionActionTests extends RestActionTestCase @Before public void setupAction() { - action = new RestAddVotingConfigExclusionAction(controller()); + action = new RestAddVotingConfigExclusionAction(); + controller().registerHandler(action); } public void testResolveVotingConfigExclusionsRequest() { diff --git a/server/src/test/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsActionTests.java b/server/src/test/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsActionTests.java index 93203b774ec36..aa4fe725e0e03 100644 --- a/server/src/test/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsActionTests.java +++ b/server/src/test/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsActionTests.java @@ -20,14 +20,11 @@ package org.elasticsearch.rest.action.admin.cluster; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.rest.FakeRestRequest; -import org.elasticsearch.usage.UsageService; import java.io.IOException; -import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Set; @@ -43,9 +40,7 @@ public class RestNodesStatsActionTests extends ESTestCase { @Override public void setUp() throws Exception { super.setUp(); - UsageService usageService = new UsageService(); - action = new RestNodesStatsAction( - new RestController(Collections.emptySet(), null, null, null, usageService)); + action = new RestNodesStatsAction(); } public void testUnrecognizedMetric() throws IOException { diff --git a/server/src/test/java/org/elasticsearch/rest/action/admin/indices/RestAnalyzeActionTests.java b/server/src/test/java/org/elasticsearch/rest/action/admin/indices/RestAnalyzeActionTests.java index 3956178587dd0..8c3c9ae03cb2b 100644 --- a/server/src/test/java/org/elasticsearch/rest/action/admin/indices/RestAnalyzeActionTests.java +++ b/server/src/test/java/org/elasticsearch/rest/action/admin/indices/RestAnalyzeActionTests.java @@ -24,7 +24,6 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.index.analysis.NameOrDefinition; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.rest.FakeRestRequest; @@ -34,7 +33,6 @@ import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.notNullValue; -import static org.mockito.Mockito.mock; public class RestAnalyzeActionTests extends ESTestCase { @@ -94,7 +92,7 @@ public void testParseXContentForAnalyzeRequestWithCustomFilters() throws Excepti } public void testParseXContentForAnalyzeRequestWithInvalidJsonThrowsException() { - RestAnalyzeAction action = new RestAnalyzeAction(mock(RestController.class)); + RestAnalyzeAction action = new RestAnalyzeAction(); RestRequest request = new FakeRestRequest.Builder(xContentRegistry()) .withContent(new BytesArray("{invalid_json}"), XContentType.JSON).build(); IOException e = expectThrows(IOException.class, () -> action.handleRequest(request, null, null)); diff --git a/server/src/test/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsActionTests.java b/server/src/test/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsActionTests.java index bdd3892e38131..6c6e2c3d4b1f0 100644 --- a/server/src/test/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsActionTests.java +++ b/server/src/test/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsActionTests.java @@ -20,14 +20,11 @@ package org.elasticsearch.rest.action.admin.indices; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.rest.FakeRestRequest; -import org.elasticsearch.usage.UsageService; import java.io.IOException; -import java.util.Collections; import java.util.HashMap; import static org.hamcrest.CoreMatchers.containsString; @@ -41,9 +38,7 @@ public class RestIndicesStatsActionTests extends ESTestCase { @Override public void setUp() throws Exception { super.setUp(); - UsageService usageService = new UsageService(); - action = new RestIndicesStatsAction( - new RestController(Collections.emptySet(), null, null, null, usageService)); + action = new RestIndicesStatsAction(); } public void testUnrecognizedMetric() throws IOException { diff --git a/server/src/test/java/org/elasticsearch/rest/action/admin/indices/RestValidateQueryActionTests.java b/server/src/test/java/org/elasticsearch/rest/action/admin/indices/RestValidateQueryActionTests.java index bd7fb60b3d567..4813e11e15bfc 100644 --- a/server/src/test/java/org/elasticsearch/rest/action/admin/indices/RestValidateQueryActionTests.java +++ b/server/src/test/java/org/elasticsearch/rest/action/admin/indices/RestValidateQueryActionTests.java @@ -59,7 +59,7 @@ public class RestValidateQueryActionTests extends AbstractSearchTestCase { private static UsageService usageService = new UsageService(); private static RestController controller = new RestController(emptySet(), null, client, new NoneCircuitBreakerService(), usageService); - private static RestValidateQueryAction action = new RestValidateQueryAction(controller); + private static RestValidateQueryAction action = new RestValidateQueryAction(); /** * Configures {@link NodeClient} to stub {@link ValidateQueryAction} transport action. @@ -81,6 +81,7 @@ protected void doExecute(Task task, ActionRequest request, ActionListener listen actions.put(ValidateQueryAction.INSTANCE, transportAction); client.initialize(actions, taskManager, () -> "local", null); + controller.registerHandler(action); } @AfterClass diff --git a/server/src/test/java/org/elasticsearch/rest/action/cat/RestCatRecoveryActionTests.java b/server/src/test/java/org/elasticsearch/rest/action/cat/RestCatRecoveryActionTests.java index 22beda1cc6eec..258844f36b71c 100644 --- a/server/src/test/java/org/elasticsearch/rest/action/cat/RestCatRecoveryActionTests.java +++ b/server/src/test/java/org/elasticsearch/rest/action/cat/RestCatRecoveryActionTests.java @@ -57,7 +57,8 @@ public void testRestRecoveryAction() { final Settings settings = Settings.EMPTY; UsageService usageService = new UsageService(); final RestController restController = new RestController(Collections.emptySet(), null, null, null, usageService); - final RestCatRecoveryAction action = new RestCatRecoveryAction(restController); + final RestCatRecoveryAction action = new RestCatRecoveryAction(); + restController.registerHandler(action); final int totalShards = randomIntBetween(1, 32); final int successfulShards = Math.max(0, totalShards - randomIntBetween(1, 2)); final int failedShards = totalShards - successfulShards; diff --git a/server/src/test/java/org/elasticsearch/rest/action/cat/RestIndicesActionTests.java b/server/src/test/java/org/elasticsearch/rest/action/cat/RestIndicesActionTests.java index 776129eb1d56a..aad58e50d69c9 100644 --- a/server/src/test/java/org/elasticsearch/rest/action/cat/RestIndicesActionTests.java +++ b/server/src/test/java/org/elasticsearch/rest/action/cat/RestIndicesActionTests.java @@ -128,7 +128,8 @@ public void testBuildTable() { } final RestController restController = new RestController(Collections.emptySet(), null, null, null, new UsageService()); - final RestIndicesAction action = new RestIndicesAction(restController); + final RestIndicesAction action = new RestIndicesAction(); + restController.registerHandler(action); final Table table = action.buildTable(new FakeRestRequest(), indicesSettings, indicesHealths, indicesStats, indicesMetaDatas); // now, verify the table is correct diff --git a/server/src/test/java/org/elasticsearch/rest/action/cat/RestNodesActionTests.java b/server/src/test/java/org/elasticsearch/rest/action/cat/RestNodesActionTests.java index 38c4837468362..3903a4d6b43f2 100644 --- a/server/src/test/java/org/elasticsearch/rest/action/cat/RestNodesActionTests.java +++ b/server/src/test/java/org/elasticsearch/rest/action/cat/RestNodesActionTests.java @@ -29,11 +29,9 @@ import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.rest.RestController; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.rest.FakeRestRequest; import org.elasticsearch.threadpool.TestThreadPool; -import org.elasticsearch.usage.UsageService; import org.junit.Before; import java.util.Collections; @@ -50,9 +48,7 @@ public class RestNodesActionTests extends ESTestCase { @Before public void setUpAction() { - UsageService usageService = new UsageService(); - action = new RestNodesAction( - new RestController(Collections.emptySet(), null, null, null, usageService)); + action = new RestNodesAction(); } public void testBuildTableDoesNotThrowGivenNullNodeInfoAndStats() { diff --git a/server/src/test/java/org/elasticsearch/rest/action/document/RestBulkActionTests.java b/server/src/test/java/org/elasticsearch/rest/action/document/RestBulkActionTests.java index b19c8c6412abc..fabd9e36051f8 100644 --- a/server/src/test/java/org/elasticsearch/rest/action/document/RestBulkActionTests.java +++ b/server/src/test/java/org/elasticsearch/rest/action/document/RestBulkActionTests.java @@ -19,8 +19,6 @@ package org.elasticsearch.rest.action.document; -import java.util.HashMap; -import java.util.Map; import org.elasticsearch.Version; import org.elasticsearch.action.bulk.BulkRequest; import org.elasticsearch.action.update.UpdateRequest; @@ -28,13 +26,15 @@ import org.elasticsearch.common.bytes.BytesArray; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.rest.RestChannel; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.rest.FakeRestRequest; import org.hamcrest.CustomMatcher; import org.mockito.Mockito; +import java.util.HashMap; +import java.util.Map; + import static org.mockito.Matchers.any; import static org.mockito.Matchers.argThat; import static org.mockito.Mockito.mock; @@ -48,7 +48,7 @@ public void testBulkPipelineUpsert() throws Exception { final NodeClient mockClient = mock(NodeClient.class); final Map params = new HashMap<>(); params.put("pipeline", "timestamps"); - new RestBulkAction(settings(Version.CURRENT).build(), mock(RestController.class)) + new RestBulkAction(settings(Version.CURRENT).build()) .handleRequest( new FakeRestRequest.Builder( xContentRegistry()).withPath("my_index/_bulk").withParams(params) diff --git a/server/src/test/java/org/elasticsearch/rest/action/document/RestGetSourceActionTests.java b/server/src/test/java/org/elasticsearch/rest/action/document/RestGetSourceActionTests.java index 924ead60c3315..38a3fdf1af617 100644 --- a/server/src/test/java/org/elasticsearch/rest/action/document/RestGetSourceActionTests.java +++ b/server/src/test/java/org/elasticsearch/rest/action/document/RestGetSourceActionTests.java @@ -46,7 +46,7 @@ public class RestGetSourceActionTests extends RestActionTestCase { @Before public void setUpAction() { - new RestGetSourceAction(controller()); + controller().registerHandler(new RestGetSourceAction()); } @AfterClass diff --git a/server/src/test/java/org/elasticsearch/rest/action/document/RestIndexActionTests.java b/server/src/test/java/org/elasticsearch/rest/action/document/RestIndexActionTests.java index 6fe27322fcd85..84bc5f3bef340 100644 --- a/server/src/test/java/org/elasticsearch/rest/action/document/RestIndexActionTests.java +++ b/server/src/test/java/org/elasticsearch/rest/action/document/RestIndexActionTests.java @@ -31,6 +31,8 @@ import org.elasticsearch.common.bytes.BytesArray; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.action.document.RestIndexAction.AutoIdHandler; +import org.elasticsearch.rest.action.document.RestIndexAction.CreateHandler; import org.elasticsearch.test.VersionUtils; import org.elasticsearch.test.rest.FakeRestRequest; import org.elasticsearch.test.rest.RestActionTestCase; @@ -47,18 +49,19 @@ public class RestIndexActionTests extends RestActionTestCase { - private RestIndexAction action; private final AtomicReference clusterStateSupplier = new AtomicReference<>(); @Before public void setUpAction() { ClusterService clusterService = mock(ClusterService.class); when(clusterService.state()).thenAnswer(invocationOnMock -> clusterStateSupplier.get()); - action = new RestIndexAction(controller(), clusterService); + controller().registerHandler(new RestIndexAction()); + controller().registerHandler(new CreateHandler()); + controller().registerHandler(new AutoIdHandler(clusterService)); } public void testCreateOpTypeValidation() { - RestIndexAction.CreateHandler create = action.new CreateHandler(); + RestIndexAction.CreateHandler create = new CreateHandler(); String opType = randomFrom("CREATE", null); create.validateOpType(opType); diff --git a/server/src/test/java/org/elasticsearch/rest/action/document/RestUpdateActionTests.java b/server/src/test/java/org/elasticsearch/rest/action/document/RestUpdateActionTests.java index b5104bb4cfc00..92776d6ccc08f 100644 --- a/server/src/test/java/org/elasticsearch/rest/action/document/RestUpdateActionTests.java +++ b/server/src/test/java/org/elasticsearch/rest/action/document/RestUpdateActionTests.java @@ -41,7 +41,8 @@ public class RestUpdateActionTests extends RestActionTestCase { @Before public void setUpAction() { - action = new RestUpdateAction(controller()); + action = new RestUpdateAction(); + controller().registerHandler(action); } public void testUpdateDocVersion() { diff --git a/server/src/test/java/org/elasticsearch/search/scroll/RestClearScrollActionTests.java b/server/src/test/java/org/elasticsearch/search/scroll/RestClearScrollActionTests.java index 8642b2648146e..03e9a242d35c0 100644 --- a/server/src/test/java/org/elasticsearch/search/scroll/RestClearScrollActionTests.java +++ b/server/src/test/java/org/elasticsearch/search/scroll/RestClearScrollActionTests.java @@ -23,7 +23,6 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.bytes.BytesArray; import org.elasticsearch.common.xcontent.XContentType; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.search.RestClearScrollAction; import org.elasticsearch.test.ESTestCase; @@ -44,7 +43,7 @@ public class RestClearScrollActionTests extends ESTestCase { public void testParseClearScrollRequestWithInvalidJsonThrowsException() throws Exception { - RestClearScrollAction action = new RestClearScrollAction(mock(RestController.class)); + RestClearScrollAction action = new RestClearScrollAction(); RestRequest request = new FakeRestRequest.Builder(xContentRegistry()) .withContent(new BytesArray("{invalid_json}"), XContentType.JSON).build(); Exception e = expectThrows(IllegalArgumentException.class, () -> action.prepareRequest(request, null)); @@ -55,7 +54,7 @@ public void testBodyParamsOverrideQueryStringParams() throws Exception { NodeClient nodeClient = mock(NodeClient.class); doNothing().when(nodeClient).searchScroll(any(), any()); - RestClearScrollAction action = new RestClearScrollAction(mock(RestController.class)); + RestClearScrollAction action = new RestClearScrollAction(); RestRequest request = new FakeRestRequest.Builder(xContentRegistry()) .withParams(Collections.singletonMap("scroll_id", "QUERY_STRING")) .withContent(new BytesArray("{\"scroll_id\": [\"BODY\"]}"), XContentType.JSON).build(); diff --git a/server/src/test/java/org/elasticsearch/search/scroll/RestSearchScrollActionTests.java b/server/src/test/java/org/elasticsearch/search/scroll/RestSearchScrollActionTests.java index b90b01d4b7b02..6c58d32b8b8bb 100644 --- a/server/src/test/java/org/elasticsearch/search/scroll/RestSearchScrollActionTests.java +++ b/server/src/test/java/org/elasticsearch/search/scroll/RestSearchScrollActionTests.java @@ -23,7 +23,6 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.bytes.BytesArray; import org.elasticsearch.common.xcontent.XContentType; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.search.RestSearchScrollAction; import org.elasticsearch.test.ESTestCase; @@ -44,7 +43,7 @@ public class RestSearchScrollActionTests extends ESTestCase { public void testParseSearchScrollRequestWithInvalidJsonThrowsException() throws Exception { - RestSearchScrollAction action = new RestSearchScrollAction(mock(RestController.class)); + RestSearchScrollAction action = new RestSearchScrollAction(); RestRequest request = new FakeRestRequest.Builder(xContentRegistry()) .withContent(new BytesArray("{invalid_json}"), XContentType.JSON).build(); Exception e = expectThrows(IllegalArgumentException.class, () -> action.prepareRequest(request, null)); @@ -55,7 +54,7 @@ public void testBodyParamsOverrideQueryStringParams() throws Exception { NodeClient nodeClient = mock(NodeClient.class); doNothing().when(nodeClient).searchScroll(any(), any()); - RestSearchScrollAction action = new RestSearchScrollAction(mock(RestController.class)); + RestSearchScrollAction action = new RestSearchScrollAction(); Map params = new HashMap<>(); params.put("scroll_id", "QUERY_STRING"); params.put("scroll", "1000m"); diff --git a/server/src/test/java/org/elasticsearch/snapshots/DedicatedClusterSnapshotRestoreIT.java b/server/src/test/java/org/elasticsearch/snapshots/DedicatedClusterSnapshotRestoreIT.java index ab5aebe853b9e..f574deee87fce 100644 --- a/server/src/test/java/org/elasticsearch/snapshots/DedicatedClusterSnapshotRestoreIT.java +++ b/server/src/test/java/org/elasticsearch/snapshots/DedicatedClusterSnapshotRestoreIT.java @@ -71,7 +71,6 @@ import org.elasticsearch.plugins.Plugin; import org.elasticsearch.repositories.RepositoryMissingException; import org.elasticsearch.rest.AbstractRestChannel; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; @@ -120,7 +119,6 @@ import static org.hamcrest.Matchers.not; import static org.hamcrest.Matchers.notNullValue; import static org.hamcrest.Matchers.nullValue; -import static org.mockito.Mockito.mock; @ClusterScope(scope = Scope.TEST, numDataNodes = 0) public class DedicatedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCase { @@ -766,8 +764,7 @@ public void testThatSensitiveRepositorySettingsAreNotExposed() throws Exception ).get(); NodeClient nodeClient = internalCluster().getInstance(NodeClient.class); - RestGetRepositoriesAction getRepoAction = new RestGetRepositoriesAction(mock(RestController.class), - internalCluster().getInstance(SettingsFilter.class)); + RestGetRepositoriesAction getRepoAction = new RestGetRepositoriesAction(internalCluster().getInstance(SettingsFilter.class)); RestRequest getRepoRequest = new FakeRestRequest(); getRepoRequest.params().put("repository", "test-repo"); final CountDownLatch getRepoLatch = new CountDownLatch(1); @@ -789,8 +786,7 @@ public void sendResponse(RestResponse response) { throw getRepoError.get(); } - RestClusterStateAction clusterStateAction = new RestClusterStateAction(mock(RestController.class), - internalCluster().getInstance(SettingsFilter.class)); + RestClusterStateAction clusterStateAction = new RestClusterStateAction(internalCluster().getInstance(SettingsFilter.class)); RestRequest clusterStateRequest = new FakeRestRequest(); final CountDownLatch clusterStateLatch = new CountDownLatch(1); final AtomicReference clusterStateError = new AtomicReference<>(); diff --git a/server/src/test/java/org/elasticsearch/usage/UsageServiceTests.java b/server/src/test/java/org/elasticsearch/usage/UsageServiceTests.java index 5a38ca8ca4ebd..1840617c29cad 100644 --- a/server/src/test/java/org/elasticsearch/usage/UsageServiceTests.java +++ b/server/src/test/java/org/elasticsearch/usage/UsageServiceTests.java @@ -26,10 +26,13 @@ import org.elasticsearch.common.transport.TransportAddress; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.rest.FakeRestRequest; import java.net.InetAddress; +import java.util.Collections; +import java.util.List; import java.util.Map; import static org.hamcrest.Matchers.equalTo; @@ -100,6 +103,11 @@ public String getName() { return name; } + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + @Override protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient client) { return channel -> { diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/Ccr.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/Ccr.java index 0fd087a47c44e..67907181699ff 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/Ccr.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/Ccr.java @@ -257,22 +257,22 @@ public List getRestHandlers(Settings settings, RestController restC return Arrays.asList( // stats API - new RestFollowStatsAction(restController), - new RestCcrStatsAction(restController), - new RestFollowInfoAction(restController), + new RestFollowStatsAction(), + new RestCcrStatsAction(), + new RestFollowInfoAction(), // follow APIs - new RestPutFollowAction(restController), - new RestResumeFollowAction(restController), - new RestPauseFollowAction(restController), - new RestUnfollowAction(restController), + new RestPutFollowAction(), + new RestResumeFollowAction(), + new RestPauseFollowAction(), + new RestUnfollowAction(), // auto-follow APIs - new RestDeleteAutoFollowPatternAction(restController), - new RestPutAutoFollowPatternAction(restController), - new RestGetAutoFollowPatternAction(restController), - new RestPauseAutoFollowPatternAction(restController), - new RestResumeAutoFollowPatternAction(restController), + new RestDeleteAutoFollowPatternAction(), + new RestPutAutoFollowPatternAction(), + new RestGetAutoFollowPatternAction(), + new RestPauseAutoFollowPatternAction(), + new RestResumeAutoFollowPatternAction(), // forget follower API - new RestForgetFollowerAction(restController)); + new RestForgetFollowerAction()); } public List getNamedWriteables() { diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestCcrStatsAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestCcrStatsAction.java index 08353212c2bf7..347bf15953f5f 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestCcrStatsAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestCcrStatsAction.java @@ -8,15 +8,23 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ccr.action.CcrStatsAction; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.GET; + public class RestCcrStatsAction extends BaseRestHandler { - public RestCcrStatsAction(final RestController controller) { - controller.registerHandler(RestRequest.Method.GET, "/_ccr/stats", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_ccr/stats", singletonList(GET)); } @Override diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestDeleteAutoFollowPatternAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestDeleteAutoFollowPatternAction.java index ae63d2004a616..c859a67053303 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestDeleteAutoFollowPatternAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestDeleteAutoFollowPatternAction.java @@ -7,17 +7,24 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ccr.action.DeleteAutoFollowPatternAction.Request; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.DELETE; import static org.elasticsearch.xpack.core.ccr.action.DeleteAutoFollowPatternAction.INSTANCE; public class RestDeleteAutoFollowPatternAction extends BaseRestHandler { - public RestDeleteAutoFollowPatternAction(RestController controller) { - controller.registerHandler(RestRequest.Method.DELETE, "/_ccr/auto_follow/{name}", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_ccr/auto_follow/{name}", singletonList(DELETE)); } @Override diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestFollowInfoAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestFollowInfoAction.java index 86aba9d31a33b..f4aed8ab46998 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestFollowInfoAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestFollowInfoAction.java @@ -9,15 +9,23 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ccr.action.FollowInfoAction; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.GET; + public class RestFollowInfoAction extends BaseRestHandler { - public RestFollowInfoAction(final RestController controller) { - controller.registerHandler(RestRequest.Method.GET, "/{index}/_ccr/info", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/{index}/_ccr/info", singletonList(GET)); } @Override diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestFollowStatsAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestFollowStatsAction.java index 31c2f5daac8e6..64fce4cb87a06 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestFollowStatsAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestFollowStatsAction.java @@ -9,15 +9,23 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ccr.action.FollowStatsAction; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.GET; + public class RestFollowStatsAction extends BaseRestHandler { - public RestFollowStatsAction(final RestController controller) { - controller.registerHandler(RestRequest.Method.GET, "/{index}/_ccr/stats", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/{index}/_ccr/stats", singletonList(GET)); } @Override diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestForgetFollowerAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestForgetFollowerAction.java index de749cde82189..19592ccb4008a 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestForgetFollowerAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestForgetFollowerAction.java @@ -9,20 +9,25 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ccr.action.ForgetFollowerAction; import org.elasticsearch.xpack.core.ccr.action.ForgetFollowerAction.Request; import java.io.IOException; -import java.util.Objects; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestForgetFollowerAction extends BaseRestHandler { - public RestForgetFollowerAction(final RestController restController) { - Objects.requireNonNull(restController); - restController.registerHandler(RestRequest.Method.POST, "/{index}/_ccr/forget_follower", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/{index}/_ccr/forget_follower", singletonList(POST)); } @Override diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestGetAutoFollowPatternAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestGetAutoFollowPatternAction.java index 0a7393dc8fcba..4acf39a277513 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestGetAutoFollowPatternAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestGetAutoFollowPatternAction.java @@ -6,19 +6,29 @@ package org.elasticsearch.xpack.ccr.rest; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ccr.action.GetAutoFollowPatternAction.Request; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.xpack.core.ccr.action.GetAutoFollowPatternAction.INSTANCE; public class RestGetAutoFollowPatternAction extends BaseRestHandler { - public RestGetAutoFollowPatternAction(RestController controller) { - controller.registerHandler(RestRequest.Method.GET, "/_ccr/auto_follow/{name}", this); - controller.registerHandler(RestRequest.Method.GET, "/_ccr/auto_follow", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_ccr/auto_follow/{name}", singletonList(GET)) + .put("/_ccr/auto_follow", singletonList(GET)) + .map()); } @Override diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPauseAutoFollowPatternAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPauseAutoFollowPatternAction.java index abfca00da5cb1..6bc5242cc6874 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPauseAutoFollowPatternAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPauseAutoFollowPatternAction.java @@ -7,17 +7,24 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ccr.action.ActivateAutoFollowPatternAction.Request; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.xpack.core.ccr.action.ActivateAutoFollowPatternAction.INSTANCE; public class RestPauseAutoFollowPatternAction extends BaseRestHandler { - public RestPauseAutoFollowPatternAction(final RestController controller) { - controller.registerHandler(RestRequest.Method.POST, "/_ccr/auto_follow/{name}/pause", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_ccr/auto_follow/{name}/pause", singletonList(POST)); } @Override diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPauseFollowAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPauseFollowAction.java index ef80fe1d36523..addbeac53a0d7 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPauseFollowAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPauseFollowAction.java @@ -7,17 +7,24 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.xpack.core.ccr.action.PauseFollowAction.INSTANCE; import static org.elasticsearch.xpack.core.ccr.action.PauseFollowAction.Request; public class RestPauseFollowAction extends BaseRestHandler { - public RestPauseFollowAction(RestController controller) { - controller.registerHandler(RestRequest.Method.POST, "/{index}/_ccr/pause_follow", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/{index}/_ccr/pause_follow", singletonList(POST)); } @Override diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPutAutoFollowPatternAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPutAutoFollowPatternAction.java index 076c3cfb18ee7..944cd1232ecd2 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPutAutoFollowPatternAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPutAutoFollowPatternAction.java @@ -8,19 +8,25 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ccr.action.PutAutoFollowPatternAction.Request; import java.io.IOException; +import java.util.List; +import java.util.Map; +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.PUT; import static org.elasticsearch.xpack.core.ccr.action.PutAutoFollowPatternAction.INSTANCE; public class RestPutAutoFollowPatternAction extends BaseRestHandler { - public RestPutAutoFollowPatternAction(RestController controller) { - controller.registerHandler(RestRequest.Method.PUT, "/_ccr/auto_follow/{name}", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_ccr/auto_follow/{name}", singletonList(PUT)); } @Override diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPutFollowAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPutFollowAction.java index 8ad2002a0c4b4..c02f7f5926cbd 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPutFollowAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPutFollowAction.java @@ -9,19 +9,25 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.List; +import java.util.Map; +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.PUT; import static org.elasticsearch.xpack.core.ccr.action.PutFollowAction.INSTANCE; import static org.elasticsearch.xpack.core.ccr.action.PutFollowAction.Request; public class RestPutFollowAction extends BaseRestHandler { - public RestPutFollowAction(RestController controller) { - controller.registerHandler(RestRequest.Method.PUT, "/{index}/_ccr/follow", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/{index}/_ccr/follow", singletonList(PUT)); } @Override diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestResumeAutoFollowPatternAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestResumeAutoFollowPatternAction.java index 89f3f65fca7d3..0cf5f4357e60a 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestResumeAutoFollowPatternAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestResumeAutoFollowPatternAction.java @@ -7,17 +7,24 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ccr.action.ActivateAutoFollowPatternAction.Request; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.xpack.core.ccr.action.ActivateAutoFollowPatternAction.INSTANCE; public class RestResumeAutoFollowPatternAction extends BaseRestHandler { - public RestResumeAutoFollowPatternAction(final RestController controller) { - controller.registerHandler(RestRequest.Method.POST, "/_ccr/auto_follow/{name}/resume", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_ccr/auto_follow/{name}/resume", singletonList(POST)); } @Override diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestResumeFollowAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestResumeFollowAction.java index 29dcd029e990e..44408b37bde92 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestResumeFollowAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestResumeFollowAction.java @@ -8,19 +8,25 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.List; +import java.util.Map; +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.xpack.core.ccr.action.ResumeFollowAction.INSTANCE; import static org.elasticsearch.xpack.core.ccr.action.ResumeFollowAction.Request; public class RestResumeFollowAction extends BaseRestHandler { - public RestResumeFollowAction(RestController controller) { - controller.registerHandler(RestRequest.Method.POST, "/{index}/_ccr/resume_follow", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/{index}/_ccr/resume_follow", singletonList(POST)); } @Override diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestUnfollowAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestUnfollowAction.java index 99a7ddac0da7b..af2915f7edcbf 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestUnfollowAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestUnfollowAction.java @@ -8,17 +8,24 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ccr.action.UnfollowAction; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.xpack.core.ccr.action.UnfollowAction.INSTANCE; public class RestUnfollowAction extends BaseRestHandler { - public RestUnfollowAction(RestController controller) { - controller.registerHandler(RestRequest.Method.POST, "/{index}/_ccr/unfollow", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/{index}/_ccr/unfollow", singletonList(POST)); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/Licensing.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/Licensing.java index 3ff79251cafe8..3ac7cfff9490e 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/Licensing.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/Licensing.java @@ -74,13 +74,13 @@ public List getRestHandlers(Settings settings, RestController restC IndexScopedSettings indexScopedSettings, SettingsFilter settingsFilter, IndexNameExpressionResolver indexNameExpressionResolver, Supplier nodesInCluster) { List handlers = new ArrayList<>(); - handlers.add(new RestGetLicenseAction(restController)); - handlers.add(new RestPutLicenseAction(restController)); - handlers.add(new RestDeleteLicenseAction(restController)); - handlers.add(new RestGetTrialStatus(restController)); - handlers.add(new RestGetBasicStatus(restController)); - handlers.add(new RestPostStartTrialLicense(restController)); - handlers.add(new RestPostStartBasicLicense(restController)); + handlers.add(new RestGetLicenseAction()); + handlers.add(new RestPutLicenseAction()); + handlers.add(new RestDeleteLicenseAction()); + handlers.add(new RestGetTrialStatus()); + handlers.add(new RestGetBasicStatus()); + handlers.add(new RestPostStartTrialLicense()); + handlers.add(new RestPostStartBasicLicense()); return handlers; } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestDeleteLicenseAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestDeleteLicenseAction.java index 383c31c332e32..fe3a8b3171549 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestDeleteLicenseAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestDeleteLicenseAction.java @@ -9,18 +9,25 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.protocol.xpack.license.DeleteLicenseRequest; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.List; +import java.util.Map; +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.DELETE; public class RestDeleteLicenseAction extends BaseRestHandler { - RestDeleteLicenseAction(RestController controller) { - controller.registerHandler(DELETE, "/_license", this); + RestDeleteLicenseAction() {} + + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_license", singletonList(DELETE)); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetBasicStatus.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetBasicStatus.java index 70dbe93bfb0fb..b8d5f34202dd5 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetBasicStatus.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetBasicStatus.java @@ -8,16 +8,24 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestGetBasicStatus extends BaseRestHandler { - RestGetBasicStatus(RestController controller) { - controller.registerHandler(GET, "/_license/basic_status", this); + RestGetBasicStatus() {} + + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_license/basic_status", singletonList(GET)); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetLicenseAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetLicenseAction.java index 99ef7e4ec2c82..5802ab0416496 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetLicenseAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetLicenseAction.java @@ -14,15 +14,18 @@ import org.elasticsearch.protocol.xpack.license.GetLicenseRequest; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestBuilderListener; import java.io.IOException; import java.util.HashMap; +import java.util.List; import java.util.Map; +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestStatus.NOT_FOUND; import static org.elasticsearch.rest.RestStatus.OK; @@ -31,8 +34,11 @@ public class RestGetLicenseAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestGetLicenseAction.class)); - RestGetLicenseAction(RestController controller) { - controller.registerHandler(GET, "/_license", this); + RestGetLicenseAction() {} + + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_license", singletonList(GET)); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetTrialStatus.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetTrialStatus.java index cac4a7d3d6d52..e7c990a87cb7c 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetTrialStatus.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetTrialStatus.java @@ -8,16 +8,24 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestGetTrialStatus extends BaseRestHandler { - RestGetTrialStatus(RestController controller) { - controller.registerHandler(GET, "/_license/trial_status", this); + RestGetTrialStatus() {} + + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_license/trial_status", singletonList(GET)); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPostStartBasicLicense.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPostStartBasicLicense.java index 6d3a82cfeadce..4fd7a22d4688a 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPostStartBasicLicense.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPostStartBasicLicense.java @@ -8,18 +8,25 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestStatusToXContentListener; import java.io.IOException; +import java.util.List; +import java.util.Map; +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestPostStartBasicLicense extends BaseRestHandler { - RestPostStartBasicLicense(RestController controller) { - controller.registerHandler(POST, "/_license/start_basic", this); + RestPostStartBasicLicense() {} + + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_license/start_basic", singletonList(POST)); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPostStartTrialLicense.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPostStartTrialLicense.java index 0e79d306f1dd5..ea9f843735e52 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPostStartTrialLicense.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPostStartTrialLicense.java @@ -10,20 +10,26 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestBuilderListener; import java.io.IOException; +import java.util.List; import java.util.Map; +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestPostStartTrialLicense extends BaseRestHandler { - RestPostStartTrialLicense(RestController controller) { - controller.registerHandler(POST, "/_license/start_trial", this); + RestPostStartTrialLicense() {} + + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_license/start_trial", singletonList(POST)); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPutLicenseAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPutLicenseAction.java index bac9946d05797..98ff2d3478eb4 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPutLicenseAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPutLicenseAction.java @@ -8,21 +8,28 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; +import java.util.List; +import java.util.Map; +import static java.util.Arrays.asList; +import static java.util.Collections.singletonMap; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.RestRequest.Method.PUT; public class RestPutLicenseAction extends BaseRestHandler { - RestPutLicenseAction(RestController controller) { + RestPutLicenseAction() {} + + @Override + public Map> handledMethodsAndPaths() { // TODO: remove POST endpoint? - controller.registerHandler(POST, "/_license", this); - controller.registerHandler(PUT, "/_license", this); + return singletonMap("/_license", unmodifiableList(asList(POST, PUT))); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackPlugin.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackPlugin.java index 9a2d5fd65eb6d..7f85b8fe6c365 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackPlugin.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackPlugin.java @@ -288,9 +288,9 @@ public List getRestHandlers(Settings settings, RestController restC IndexScopedSettings indexScopedSettings, SettingsFilter settingsFilter, IndexNameExpressionResolver indexNameExpressionResolver, Supplier nodesInCluster) { List handlers = new ArrayList<>(); - handlers.add(new RestXPackInfoAction(restController)); - handlers.add(new RestXPackUsageAction(restController)); - handlers.add(new RestReloadAnalyzersAction(restController)); + handlers.add(new RestXPackInfoAction()); + handlers.add(new RestXPackUsageAction()); + handlers.add(new RestReloadAnalyzersAction()); handlers.addAll(licensing.getRestHandlers(settings, restController, clusterSettings, indexScopedSettings, settingsFilter, indexNameExpressionResolver, nodesInCluster)); return handlers; diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rest/action/RestReloadAnalyzersAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rest/action/RestReloadAnalyzersAction.java index e3641f079f321..0d058293ce900 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rest/action/RestReloadAnalyzersAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rest/action/RestReloadAnalyzersAction.java @@ -9,18 +9,27 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.action.ReloadAnalyzerAction; import org.elasticsearch.xpack.core.action.ReloadAnalyzersRequest; import java.io.IOException; +import java.util.List; +import java.util.Map; + +import static java.util.Arrays.asList; +import static java.util.Collections.singletonMap; +import static java.util.Collections.unmodifiableList; +import static org.elasticsearch.rest.RestRequest.Method.GET; +import static org.elasticsearch.rest.RestRequest.Method.POST; + public class RestReloadAnalyzersAction extends BaseRestHandler { - public RestReloadAnalyzersAction(RestController controller) { - controller.registerHandler(RestRequest.Method.GET, "/{index}/_reload_search_analyzers", this); - controller.registerHandler(RestRequest.Method.POST, "/{index}/_reload_search_analyzers", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/{index}/_reload_search_analyzers", unmodifiableList(asList(GET, POST))); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rest/action/RestXPackInfoAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rest/action/RestXPackInfoAction.java index 2da02fc111aaa..1080b64e84aca 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rest/action/RestXPackInfoAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rest/action/RestXPackInfoAction.java @@ -8,21 +8,27 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.protocol.xpack.XPackInfoRequest; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.action.XPackInfoRequestBuilder; import java.io.IOException; import java.util.EnumSet; +import java.util.List; +import java.util.Map; +import static java.util.Arrays.asList; +import static java.util.Collections.singletonMap; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.HEAD; public class RestXPackInfoAction extends BaseRestHandler { - public RestXPackInfoAction(RestController controller) { - controller.registerHandler(HEAD, "/_xpack", this); - controller.registerHandler(GET, "/_xpack", this); + + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_xpack", unmodifiableList(asList(GET, HEAD))); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rest/action/RestXPackUsageAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rest/action/RestXPackUsageAction.java index 56eaae48460d5..843ccbfd4a02f 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rest/action/RestXPackUsageAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rest/action/RestXPackUsageAction.java @@ -11,8 +11,8 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestBuilderListener; import org.elasticsearch.xpack.core.XPackFeatureSet; @@ -20,14 +20,19 @@ import org.elasticsearch.xpack.core.action.XPackUsageResponse; import java.io.IOException; +import java.util.List; +import java.util.Map; +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestStatus.OK; public class RestXPackUsageAction extends BaseRestHandler { - public RestXPackUsageAction(RestController controller) { - controller.registerHandler(GET, "/_xpack/usage", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_xpack/usage", singletonList(GET)); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/rest/RestGetCertificateInfoAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/rest/RestGetCertificateInfoAction.java index d00bba383e90d..f2ebca3624703 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/rest/RestGetCertificateInfoAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/rest/RestGetCertificateInfoAction.java @@ -9,14 +9,19 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; import org.elasticsearch.xpack.core.ssl.action.GetCertificateInfoAction; import org.elasticsearch.xpack.core.ssl.action.GetCertificateInfoAction.Response; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; /** @@ -25,8 +30,9 @@ */ public class RestGetCertificateInfoAction extends BaseRestHandler { - public RestGetCertificateInfoAction(RestController controller) { - controller.registerHandler(GET, "/_ssl/certificates", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_ssl/certificates", singletonList(GET)); } @Override diff --git a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/Deprecation.java b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/Deprecation.java index c473e74db0eb4..6d17f634c9a78 100644 --- a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/Deprecation.java +++ b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/Deprecation.java @@ -44,6 +44,6 @@ public List getRestHandlers(Settings settings, RestController restC Supplier nodesInCluster) { - return Collections.singletonList(new RestDeprecationInfoAction(restController)); + return Collections.singletonList(new RestDeprecationInfoAction()); } } diff --git a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/RestDeprecationInfoAction.java b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/RestDeprecationInfoAction.java index 065a40b46e8a5..773e9cd0a36bf 100644 --- a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/RestDeprecationInfoAction.java +++ b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/RestDeprecationInfoAction.java @@ -5,25 +5,32 @@ */ package org.elasticsearch.xpack.deprecation; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.deprecation.DeprecationInfoAction; import org.elasticsearch.xpack.core.deprecation.DeprecationInfoAction.Request; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestDeprecationInfoAction extends BaseRestHandler { - private static final Logger logger = LogManager.getLogger(RestDeprecationInfoAction.class); - public RestDeprecationInfoAction(RestController controller) { - controller.registerHandler(RestRequest.Method.GET, "/_migration/deprecations", this); - controller.registerHandler(RestRequest.Method.GET, "/{index}/_migration/deprecations", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_migration/deprecations", singletonList(GET)) + .put("/{index}/_migration/deprecations", singletonList(GET)) + .map()); } @Override @@ -33,7 +40,7 @@ public String getName() { @Override public RestChannelConsumer prepareRequest(RestRequest request, NodeClient client) throws IOException { - if (request.method().equals(RestRequest.Method.GET)) { + if (request.method().equals(GET)) { return handleGet(request, client); } else { throw new IllegalArgumentException("illegal method [" + request.method() + "] for request [" + request.path() + "]"); diff --git a/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/EnrichPlugin.java b/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/EnrichPlugin.java index 54dd0b219a7b7..20281a3933bf4 100644 --- a/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/EnrichPlugin.java +++ b/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/EnrichPlugin.java @@ -176,11 +176,11 @@ public List getRestHandlers( } return List.of( - new RestGetEnrichPolicyAction(restController), - new RestDeleteEnrichPolicyAction(restController), - new RestPutEnrichPolicyAction(restController), - new RestExecuteEnrichPolicyAction(restController), - new RestEnrichStatsAction(restController) + new RestGetEnrichPolicyAction(), + new RestDeleteEnrichPolicyAction(), + new RestPutEnrichPolicyAction(), + new RestExecuteEnrichPolicyAction(), + new RestEnrichStatsAction() ); } diff --git a/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestDeleteEnrichPolicyAction.java b/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestDeleteEnrichPolicyAction.java index 01c23d91fed24..ec965be099cd8 100644 --- a/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestDeleteEnrichPolicyAction.java +++ b/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestDeleteEnrichPolicyAction.java @@ -7,17 +7,24 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.enrich.action.DeleteEnrichPolicyAction; import java.io.IOException; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.DELETE; public class RestDeleteEnrichPolicyAction extends BaseRestHandler { - public RestDeleteEnrichPolicyAction(final RestController controller) { - controller.registerHandler(RestRequest.Method.DELETE, "/_enrich/policy/{name}", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_enrich/policy/{name}", singletonList(DELETE)); } @Override diff --git a/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestEnrichStatsAction.java b/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestEnrichStatsAction.java index 586e1c255dd7c..e103a6d9cd92e 100644 --- a/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestEnrichStatsAction.java +++ b/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestEnrichStatsAction.java @@ -7,17 +7,24 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.enrich.action.EnrichStatsAction; import java.io.IOException; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestEnrichStatsAction extends BaseRestHandler { - public RestEnrichStatsAction(final RestController controller) { - controller.registerHandler(RestRequest.Method.GET, "/_enrich/_stats", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_enrich/_stats", singletonList(GET)); } @Override diff --git a/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestExecuteEnrichPolicyAction.java b/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestExecuteEnrichPolicyAction.java index 087117a6c1a45..ee1ed9f4296c4 100644 --- a/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestExecuteEnrichPolicyAction.java +++ b/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestExecuteEnrichPolicyAction.java @@ -7,18 +7,26 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.enrich.action.ExecuteEnrichPolicyAction; import java.io.IOException; +import java.util.List; +import java.util.Map; + +import static java.util.Arrays.asList; +import static java.util.Collections.singletonMap; +import static java.util.Collections.unmodifiableList; +import static org.elasticsearch.rest.RestRequest.Method.POST; +import static org.elasticsearch.rest.RestRequest.Method.PUT; public class RestExecuteEnrichPolicyAction extends BaseRestHandler { - public RestExecuteEnrichPolicyAction(final RestController controller) { - controller.registerHandler(RestRequest.Method.PUT, "/_enrich/policy/{name}/_execute", this); - controller.registerHandler(RestRequest.Method.POST, "/_enrich/policy/{name}/_execute", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_enrich/policy/{name}/_execute", unmodifiableList(asList(POST, PUT))); } @Override diff --git a/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestGetEnrichPolicyAction.java b/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestGetEnrichPolicyAction.java index 3a279a49fa49c..3be0d2f3f4505 100644 --- a/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestGetEnrichPolicyAction.java +++ b/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestGetEnrichPolicyAction.java @@ -7,19 +7,31 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.enrich.action.GetEnrichPolicyAction; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestGetEnrichPolicyAction extends BaseRestHandler { - public RestGetEnrichPolicyAction(final RestController controller) { - controller.registerHandler(RestRequest.Method.GET, "/_enrich/policy/{name}", this); - controller.registerHandler(RestRequest.Method.GET, "/_enrich/policy", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap( + MapBuilder.>newMapBuilder() + .put("/_enrich/policy/{name}", singletonList(GET)) + .put("/_enrich/policy", singletonList(GET)) + .map() + ); } @Override diff --git a/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestPutEnrichPolicyAction.java b/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestPutEnrichPolicyAction.java index 38d36447d8ee1..84685771a35cf 100644 --- a/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestPutEnrichPolicyAction.java +++ b/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestPutEnrichPolicyAction.java @@ -8,17 +8,24 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.enrich.action.PutEnrichPolicyAction; import java.io.IOException; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.PUT; public class RestPutEnrichPolicyAction extends BaseRestHandler { - public RestPutEnrichPolicyAction(final RestController controller) { - controller.registerHandler(RestRequest.Method.PUT, "/_enrich/policy/{name}", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_enrich/policy/{name}", singletonList(PUT)); } @Override diff --git a/x-pack/plugin/eql/src/main/java/org/elasticsearch/xpack/eql/plugin/EqlPlugin.java b/x-pack/plugin/eql/src/main/java/org/elasticsearch/xpack/eql/plugin/EqlPlugin.java index abed7c607acfd..1d9bbe75956e7 100644 --- a/x-pack/plugin/eql/src/main/java/org/elasticsearch/xpack/eql/plugin/EqlPlugin.java +++ b/x-pack/plugin/eql/src/main/java/org/elasticsearch/xpack/eql/plugin/EqlPlugin.java @@ -104,6 +104,6 @@ public List getRestHandlers(Settings settings, if (isEnabled(settings) == false) { return Collections.emptyList(); } - return Arrays.asList(new RestEqlSearchAction(restController)); + return Collections.singletonList(new RestEqlSearchAction()); } } \ No newline at end of file diff --git a/x-pack/plugin/eql/src/main/java/org/elasticsearch/xpack/eql/plugin/RestEqlSearchAction.java b/x-pack/plugin/eql/src/main/java/org/elasticsearch/xpack/eql/plugin/RestEqlSearchAction.java index 8a46ba44185de..8938462bfb046 100644 --- a/x-pack/plugin/eql/src/main/java/org/elasticsearch/xpack/eql/plugin/RestEqlSearchAction.java +++ b/x-pack/plugin/eql/src/main/java/org/elasticsearch/xpack/eql/plugin/RestEqlSearchAction.java @@ -5,34 +5,38 @@ */ package org.elasticsearch.xpack.eql.plugin; +import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.xcontent.XContentBuilder; +import org.elasticsearch.common.xcontent.XContentParser; +import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; - -import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.rest.action.RestResponseListener; import org.elasticsearch.xpack.eql.action.EqlSearchAction; import org.elasticsearch.xpack.eql.action.EqlSearchRequest; import org.elasticsearch.xpack.eql.action.EqlSearchResponse; import java.io.IOException; +import java.util.List; +import java.util.Map; +import static java.util.Arrays.asList; +import static java.util.Collections.singletonMap; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestEqlSearchAction extends BaseRestHandler { private static final String SEARCH_PATH = "/{index}/_eql/search"; - public RestEqlSearchAction(RestController controller) { - controller.registerHandler(GET, SEARCH_PATH, this); - controller.registerHandler(POST, SEARCH_PATH, this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap(SEARCH_PATH, unmodifiableList(asList(GET, POST))); } @Override diff --git a/x-pack/plugin/frozen-indices/src/main/java/org/elasticsearch/xpack/frozen/FrozenIndices.java b/x-pack/plugin/frozen-indices/src/main/java/org/elasticsearch/xpack/frozen/FrozenIndices.java index 89b5fa7adccb2..018f684c6389d 100644 --- a/x-pack/plugin/frozen-indices/src/main/java/org/elasticsearch/xpack/frozen/FrozenIndices.java +++ b/x-pack/plugin/frozen-indices/src/main/java/org/elasticsearch/xpack/frozen/FrozenIndices.java @@ -74,6 +74,6 @@ public List getRestHandlers(Settings settings, RestController restC IndexScopedSettings indexScopedSettings, SettingsFilter settingsFilter, IndexNameExpressionResolver indexNameExpressionResolver, Supplier nodesInCluster) { - return Collections.singletonList(new RestFreezeIndexAction(restController)); + return Collections.singletonList(new RestFreezeIndexAction()); } } diff --git a/x-pack/plugin/frozen-indices/src/main/java/org/elasticsearch/xpack/frozen/rest/action/RestFreezeIndexAction.java b/x-pack/plugin/frozen-indices/src/main/java/org/elasticsearch/xpack/frozen/rest/action/RestFreezeIndexAction.java index 4bc113449c34a..595dddaa96adc 100644 --- a/x-pack/plugin/frozen-indices/src/main/java/org/elasticsearch/xpack/frozen/rest/action/RestFreezeIndexAction.java +++ b/x-pack/plugin/frozen-indices/src/main/java/org/elasticsearch/xpack/frozen/rest/action/RestFreezeIndexAction.java @@ -9,18 +9,29 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.protocol.xpack.frozen.FreezeRequest; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.frozen.action.FreezeIndexAction; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static org.elasticsearch.rest.RestRequest.Method.POST; + public final class RestFreezeIndexAction extends BaseRestHandler { - public RestFreezeIndexAction(RestController controller) { - controller.registerHandler(RestRequest.Method.POST, "/{index}/_freeze", this); - controller.registerHandler(RestRequest.Method.POST, "/{index}/_unfreeze", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/{index}/_freeze", singletonList(POST)) + .put("/{index}/_unfreeze", singletonList(POST)) + .map()); } @Override diff --git a/x-pack/plugin/graph/src/main/java/org/elasticsearch/xpack/graph/Graph.java b/x-pack/plugin/graph/src/main/java/org/elasticsearch/xpack/graph/Graph.java index b918f6e5dde80..e8c6223e504a1 100644 --- a/x-pack/plugin/graph/src/main/java/org/elasticsearch/xpack/graph/Graph.java +++ b/x-pack/plugin/graph/src/main/java/org/elasticsearch/xpack/graph/Graph.java @@ -60,6 +60,6 @@ public List getRestHandlers(Settings settings, RestController restC if (false == enabled) { return emptyList(); } - return singletonList(new RestGraphAction(restController)); + return singletonList(new RestGraphAction()); } } diff --git a/x-pack/plugin/graph/src/main/java/org/elasticsearch/xpack/graph/rest/action/RestGraphAction.java b/x-pack/plugin/graph/src/main/java/org/elasticsearch/xpack/graph/rest/action/RestGraphAction.java index cf0dbfeb0d646..62a204656fcc1 100644 --- a/x-pack/plugin/graph/src/main/java/org/elasticsearch/xpack/graph/rest/action/RestGraphAction.java +++ b/x-pack/plugin/graph/src/main/java/org/elasticsearch/xpack/graph/rest/action/RestGraphAction.java @@ -18,15 +18,19 @@ import org.elasticsearch.protocol.xpack.graph.Hop; import org.elasticsearch.protocol.xpack.graph.VertexRequest; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; +import static java.util.Arrays.asList; +import static java.util.Collections.singletonMap; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.index.query.AbstractQueryBuilder.parseInnerQueryBuilder; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -56,9 +60,9 @@ public class RestGraphAction extends BaseRestHandler { public static final ParseField BOOST_FIELD = new ParseField("boost"); public static final ParseField TERM_FIELD = new ParseField("term"); - public RestGraphAction(RestController controller) { - controller.registerHandler(GET, "/{index}/_graph/explore", this); - controller.registerHandler(POST, "/{index}/_graph/explore", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/{index}/_graph/explore", unmodifiableList(asList(GET, POST))); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/IndexLifecycle.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/IndexLifecycle.java index 96e9a49bc9254..951571b992409 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/IndexLifecycle.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/IndexLifecycle.java @@ -241,29 +241,29 @@ public List getRestHandlers(Settings settings, RestController restC List handlers = new ArrayList<>(); if (ilmEnabled) { handlers.addAll(Arrays.asList( - new RestPutLifecycleAction(restController), - new RestGetLifecycleAction(restController), - new RestDeleteLifecycleAction(restController), - new RestExplainLifecycleAction(restController), - new RestRemoveIndexLifecyclePolicyAction(restController), - new RestMoveToStepAction(restController), - new RestRetryAction(restController), - new RestStopAction(restController), - new RestStartILMAction(restController), - new RestGetStatusAction(restController) + new RestPutLifecycleAction(), + new RestGetLifecycleAction(), + new RestDeleteLifecycleAction(), + new RestExplainLifecycleAction(), + new RestRemoveIndexLifecyclePolicyAction(), + new RestMoveToStepAction(), + new RestRetryAction(), + new RestStopAction(), + new RestStartILMAction(), + new RestGetStatusAction() )); } if (slmEnabled) { handlers.addAll(Arrays.asList( - new RestPutSnapshotLifecycleAction(restController), - new RestDeleteSnapshotLifecycleAction(restController), - new RestGetSnapshotLifecycleAction(restController), - new RestExecuteSnapshotLifecycleAction(restController), - new RestGetSnapshotLifecycleStatsAction(restController), - new RestExecuteSnapshotRetentionAction(restController), - new RestStopSLMAction(restController), - new RestStartSLMAction(restController), - new RestGetSLMStatusAction(restController) + new RestPutSnapshotLifecycleAction(), + new RestDeleteSnapshotLifecycleAction(), + new RestGetSnapshotLifecycleAction(), + new RestExecuteSnapshotLifecycleAction(), + new RestGetSnapshotLifecycleStatsAction(), + new RestExecuteSnapshotRetentionAction(), + new RestStopSLMAction(), + new RestStartSLMAction(), + new RestGetSLMStatusAction() )); } return handlers; diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestDeleteLifecycleAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestDeleteLifecycleAction.java index 999eaafdb03bf..381328d849ba3 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestDeleteLifecycleAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestDeleteLifecycleAction.java @@ -8,15 +8,23 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ilm.action.DeleteLifecycleAction; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.DELETE; + public class RestDeleteLifecycleAction extends BaseRestHandler { - public RestDeleteLifecycleAction(RestController controller) { - controller.registerHandler(RestRequest.Method.DELETE, "/_ilm/policy/{name}", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_ilm/policy/{name}", singletonList(DELETE)); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestExplainLifecycleAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestExplainLifecycleAction.java index d8fb127755208..7999ec706f47a 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestExplainLifecycleAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestExplainLifecycleAction.java @@ -10,16 +10,24 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ilm.ExplainLifecycleRequest; import org.elasticsearch.xpack.core.ilm.action.ExplainLifecycleAction; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.GET; + public class RestExplainLifecycleAction extends BaseRestHandler { - public RestExplainLifecycleAction(RestController controller) { - controller.registerHandler(RestRequest.Method.GET, "/{index}/_ilm/explain", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/{index}/_ilm/explain", singletonList(GET)); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestGetLifecycleAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestGetLifecycleAction.java index 794de5d576347..e76c16c69e507 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestGetLifecycleAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestGetLifecycleAction.java @@ -8,17 +8,28 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ilm.action.GetLifecycleAction; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static org.elasticsearch.rest.RestRequest.Method.GET; + public class RestGetLifecycleAction extends BaseRestHandler { - public RestGetLifecycleAction(RestController controller) { - controller.registerHandler(RestRequest.Method.GET, "/_ilm/policy", this); - controller.registerHandler(RestRequest.Method.GET, "/_ilm/policy/{name}", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_ilm/policy", singletonList(GET)) + .put("/_ilm/policy/{name}", singletonList(GET)) + .map()); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestGetStatusAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestGetStatusAction.java index 5ff3c046321e7..77ab9874c11be 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestGetStatusAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestGetStatusAction.java @@ -8,15 +8,23 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ilm.action.GetStatusAction; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.POST; + public class RestGetStatusAction extends BaseRestHandler { - public RestGetStatusAction(RestController controller) { - controller.registerHandler(RestRequest.Method.GET, "/_ilm/status", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_ilm/status", singletonList(POST)); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestMoveToStepAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestMoveToStepAction.java index 44a765b0c6aa8..5a10e792fa167 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestMoveToStepAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestMoveToStepAction.java @@ -10,17 +10,24 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ilm.action.MoveToStepAction; import java.io.IOException; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestMoveToStepAction extends BaseRestHandler { - public RestMoveToStepAction(RestController controller) { - controller.registerHandler(RestRequest.Method.POST,"/_ilm/move/{name}", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_ilm/move/{name}", singletonList(POST)); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestPutLifecycleAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestPutLifecycleAction.java index 5e357c9535efd..881cfe0662d45 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestPutLifecycleAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestPutLifecycleAction.java @@ -9,17 +9,24 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ilm.action.PutLifecycleAction; import java.io.IOException; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.PUT; public class RestPutLifecycleAction extends BaseRestHandler { - public RestPutLifecycleAction(RestController controller) { - controller.registerHandler(RestRequest.Method.PUT, "/_ilm/policy/{name}", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_ilm/policy/{name}", singletonList(PUT)); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestRemoveIndexLifecyclePolicyAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestRemoveIndexLifecyclePolicyAction.java index 7bca784878b49..e08b8b03d56dc 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestRemoveIndexLifecyclePolicyAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestRemoveIndexLifecyclePolicyAction.java @@ -10,15 +10,23 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ilm.action.RemoveIndexLifecyclePolicyAction; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.POST; + public class RestRemoveIndexLifecyclePolicyAction extends BaseRestHandler { - public RestRemoveIndexLifecyclePolicyAction(RestController controller) { - controller.registerHandler(RestRequest.Method.POST, "/{index}/_ilm/remove", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/{index}/_ilm/remove", singletonList(POST)); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestRetryAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestRetryAction.java index e14e1dac049b2..56c734b5d8990 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestRetryAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestRetryAction.java @@ -11,15 +11,23 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ilm.action.RetryAction; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.POST; + public class RestRetryAction extends BaseRestHandler { - public RestRetryAction(RestController controller) { - controller.registerHandler(RestRequest.Method.POST, "/{index}/_ilm/retry", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/{index}/_ilm/retry", singletonList(POST)); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestStartILMAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestStartILMAction.java index b240a5e274e05..b4dcbd795829f 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestStartILMAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestStartILMAction.java @@ -8,16 +8,24 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ilm.StartILMRequest; import org.elasticsearch.xpack.core.ilm.action.StartILMAction; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.POST; + public class RestStartILMAction extends BaseRestHandler { - public RestStartILMAction(RestController controller) { - controller.registerHandler(RestRequest.Method.POST, "/_ilm/start", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_ilm/start", singletonList(POST)); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestStopAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestStopAction.java index 3843d4da773a6..39908494c5e1c 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestStopAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestStopAction.java @@ -8,16 +8,24 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ilm.StopILMRequest; import org.elasticsearch.xpack.core.ilm.action.StopILMAction; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.POST; + public class RestStopAction extends BaseRestHandler { - public RestStopAction(RestController controller) { - controller.registerHandler(RestRequest.Method.POST, "/_ilm/stop", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_ilm/stop", singletonList(POST)); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestDeleteSnapshotLifecycleAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestDeleteSnapshotLifecycleAction.java index 658816d2bab82..912387d51a251 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestDeleteSnapshotLifecycleAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestDeleteSnapshotLifecycleAction.java @@ -8,15 +8,23 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.slm.action.DeleteSnapshotLifecycleAction; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.DELETE; + public class RestDeleteSnapshotLifecycleAction extends BaseRestHandler { - public RestDeleteSnapshotLifecycleAction(RestController controller) { - controller.registerHandler(RestRequest.Method.DELETE, "/_slm/policy/{name}", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_slm/policy/{name}", singletonList(DELETE)); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestExecuteSnapshotLifecycleAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestExecuteSnapshotLifecycleAction.java index 72eceee0f8ecc..e53ea12ae113e 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestExecuteSnapshotLifecycleAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestExecuteSnapshotLifecycleAction.java @@ -8,16 +8,25 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.slm.action.ExecuteSnapshotLifecycleAction; +import java.util.List; +import java.util.Map; + +import static java.util.Arrays.asList; +import static java.util.Collections.singletonMap; +import static java.util.Collections.unmodifiableList; +import static org.elasticsearch.rest.RestRequest.Method.POST; +import static org.elasticsearch.rest.RestRequest.Method.PUT; + public class RestExecuteSnapshotLifecycleAction extends BaseRestHandler { - public RestExecuteSnapshotLifecycleAction(RestController controller) { - controller.registerHandler(RestRequest.Method.PUT, "/_slm/policy/{name}/_execute", this); - controller.registerHandler(RestRequest.Method.POST, "/_slm/policy/{name}/_execute", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_slm/policy/{name}/_execute", unmodifiableList(asList(POST, PUT))); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestExecuteSnapshotRetentionAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestExecuteSnapshotRetentionAction.java index 8bf2e3e870e1d..5ba20e7f637ba 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestExecuteSnapshotRetentionAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestExecuteSnapshotRetentionAction.java @@ -8,15 +8,23 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.slm.action.ExecuteSnapshotRetentionAction; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.POST; + public class RestExecuteSnapshotRetentionAction extends BaseRestHandler { - public RestExecuteSnapshotRetentionAction(RestController controller) { - controller.registerHandler(RestRequest.Method.POST, "/_slm/_execute_retention", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_slm/_execute_retention", singletonList(POST)); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestGetSLMStatusAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestGetSLMStatusAction.java index 26f3197a76125..91048f7b3fde3 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestGetSLMStatusAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestGetSLMStatusAction.java @@ -8,15 +8,23 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.slm.action.GetSLMStatusAction; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.GET; + public class RestGetSLMStatusAction extends BaseRestHandler { - public RestGetSLMStatusAction(RestController controller) { - controller.registerHandler(RestRequest.Method.GET, "/_slm/status", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_slm/status", singletonList(GET)); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestGetSnapshotLifecycleAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestGetSnapshotLifecycleAction.java index cd2e67bb732a1..b38a346ce3d14 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestGetSnapshotLifecycleAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestGetSnapshotLifecycleAction.java @@ -8,17 +8,28 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.slm.action.GetSnapshotLifecycleAction; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static org.elasticsearch.rest.RestRequest.Method.GET; + public class RestGetSnapshotLifecycleAction extends BaseRestHandler { - public RestGetSnapshotLifecycleAction(RestController controller) { - controller.registerHandler(RestRequest.Method.GET, "/_slm/policy", this); - controller.registerHandler(RestRequest.Method.GET, "/_slm/policy/{name}", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_slm/policy", singletonList(GET)) + .put("/_slm/policy/{name}", singletonList(GET)) + .map()); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestGetSnapshotLifecycleStatsAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestGetSnapshotLifecycleStatsAction.java index b8629c2db5760..ab530e81e54ef 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestGetSnapshotLifecycleStatsAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestGetSnapshotLifecycleStatsAction.java @@ -8,15 +8,23 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.slm.action.GetSnapshotLifecycleStatsAction; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.GET; + public class RestGetSnapshotLifecycleStatsAction extends BaseRestHandler { - public RestGetSnapshotLifecycleStatsAction(RestController controller) { - controller.registerHandler(RestRequest.Method.GET, "/_slm/stats", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_slm/stats", singletonList(GET)); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestPutSnapshotLifecycleAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestPutSnapshotLifecycleAction.java index a5183739f3f5b..392bb6caa1da4 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestPutSnapshotLifecycleAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestPutSnapshotLifecycleAction.java @@ -9,17 +9,24 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.slm.action.PutSnapshotLifecycleAction; import java.io.IOException; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.PUT; public class RestPutSnapshotLifecycleAction extends BaseRestHandler { - public RestPutSnapshotLifecycleAction(RestController controller) { - controller.registerHandler(RestRequest.Method.PUT, "/_slm/policy/{name}", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_slm/policy/{name}", singletonList(PUT)); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestStartSLMAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestStartSLMAction.java index 87dc7d2bb2279..ea737bcd784a0 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestStartSLMAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestStartSLMAction.java @@ -8,15 +8,23 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.slm.action.StartSLMAction; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.POST; + public class RestStartSLMAction extends BaseRestHandler { - public RestStartSLMAction(RestController controller) { - controller.registerHandler(RestRequest.Method.POST, "/_slm/start", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_slm/start", singletonList(POST)); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestStopSLMAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestStopSLMAction.java index ac74b37d58751..d52776fb6f730 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestStopSLMAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestStopSLMAction.java @@ -8,15 +8,23 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.slm.action.StopSLMAction; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.POST; + public class RestStopSLMAction extends BaseRestHandler { - public RestStopSLMAction(RestController controller) { - controller.registerHandler(RestRequest.Method.POST, "/_slm/stop", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_slm/stop", singletonList(POST)); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/MachineLearning.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/MachineLearning.java index 5469da943f272..d82fd9b8384b2 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/MachineLearning.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/MachineLearning.java @@ -715,68 +715,68 @@ public List getRestHandlers(Settings settings, RestController restC return emptyList(); } return Arrays.asList( - new RestGetJobsAction(restController), - new RestGetJobStatsAction(restController), - new RestMlInfoAction(restController), - new RestPutJobAction(restController), - new RestPostJobUpdateAction(restController), - new RestDeleteJobAction(restController), - new RestOpenJobAction(restController), - new RestGetFiltersAction(restController), - new RestPutFilterAction(restController), - new RestUpdateFilterAction(restController), - new RestDeleteFilterAction(restController), - new RestGetInfluencersAction(restController), - new RestGetRecordsAction(restController), - new RestGetBucketsAction(restController), - new RestGetOverallBucketsAction(restController), - new RestPostDataAction(restController), - new RestCloseJobAction(restController), - new RestFlushJobAction(restController), - new RestValidateDetectorAction(restController), - new RestValidateJobConfigAction(restController), - new RestGetCategoriesAction(restController), - new RestGetModelSnapshotsAction(restController), - new RestRevertModelSnapshotAction(restController), - new RestUpdateModelSnapshotAction(restController), - new RestGetDatafeedsAction(restController), - new RestGetDatafeedStatsAction(restController), - new RestPutDatafeedAction(restController), - new RestUpdateDatafeedAction(restController), - new RestDeleteDatafeedAction(restController), - new RestPreviewDatafeedAction(restController), - new RestStartDatafeedAction(restController), - new RestStopDatafeedAction(restController), - new RestDeleteModelSnapshotAction(restController), - new RestDeleteExpiredDataAction(restController), - new RestForecastJobAction(restController), - new RestDeleteForecastAction(restController), - new RestGetCalendarsAction(restController), - new RestPutCalendarAction(restController), - new RestDeleteCalendarAction(restController), - new RestDeleteCalendarEventAction(restController), - new RestDeleteCalendarJobAction(restController), - new RestPutCalendarJobAction(restController), - new RestGetCalendarEventsAction(restController), - new RestPostCalendarEventAction(restController), - new RestFindFileStructureAction(restController), - new RestSetUpgradeModeAction(restController), - new RestGetDataFrameAnalyticsAction(restController), - new RestGetDataFrameAnalyticsStatsAction(restController), - new RestPutDataFrameAnalyticsAction(restController), - new RestDeleteDataFrameAnalyticsAction(restController), - new RestStartDataFrameAnalyticsAction(restController), - new RestStopDataFrameAnalyticsAction(restController), - new RestEvaluateDataFrameAction(restController), - new RestExplainDataFrameAnalyticsAction(restController), - new RestGetTrainedModelsAction(restController), - new RestDeleteTrainedModelAction(restController), - new RestGetTrainedModelsStatsAction(restController), - new RestPutTrainedModelAction(restController), + new RestGetJobsAction(), + new RestGetJobStatsAction(), + new RestMlInfoAction(), + new RestPutJobAction(), + new RestPostJobUpdateAction(), + new RestDeleteJobAction(), + new RestOpenJobAction(), + new RestGetFiltersAction(), + new RestPutFilterAction(), + new RestUpdateFilterAction(), + new RestDeleteFilterAction(), + new RestGetInfluencersAction(), + new RestGetRecordsAction(), + new RestGetBucketsAction(), + new RestGetOverallBucketsAction(), + new RestPostDataAction(), + new RestCloseJobAction(), + new RestFlushJobAction(), + new RestValidateDetectorAction(), + new RestValidateJobConfigAction(), + new RestGetCategoriesAction(), + new RestGetModelSnapshotsAction(), + new RestRevertModelSnapshotAction(), + new RestUpdateModelSnapshotAction(), + new RestGetDatafeedsAction(), + new RestGetDatafeedStatsAction(), + new RestPutDatafeedAction(), + new RestUpdateDatafeedAction(), + new RestDeleteDatafeedAction(), + new RestPreviewDatafeedAction(), + new RestStartDatafeedAction(), + new RestStopDatafeedAction(), + new RestDeleteModelSnapshotAction(), + new RestDeleteExpiredDataAction(), + new RestForecastJobAction(), + new RestDeleteForecastAction(), + new RestGetCalendarsAction(), + new RestPutCalendarAction(), + new RestDeleteCalendarAction(), + new RestDeleteCalendarEventAction(), + new RestDeleteCalendarJobAction(), + new RestPutCalendarJobAction(), + new RestGetCalendarEventsAction(), + new RestPostCalendarEventAction(), + new RestFindFileStructureAction(), + new RestSetUpgradeModeAction(), + new RestGetDataFrameAnalyticsAction(), + new RestGetDataFrameAnalyticsStatsAction(), + new RestPutDataFrameAnalyticsAction(), + new RestDeleteDataFrameAnalyticsAction(), + new RestStartDataFrameAnalyticsAction(), + new RestStopDataFrameAnalyticsAction(), + new RestEvaluateDataFrameAction(), + new RestExplainDataFrameAnalyticsAction(), + new RestGetTrainedModelsAction(), + new RestDeleteTrainedModelAction(), + new RestGetTrainedModelsStatsAction(), + new RestPutTrainedModelAction(), // CAT Handlers - new RestCatJobsAction(restController), - new RestCatTrainedModelsAction(restController), - new RestCatDatafeedsAction(restController) + new RestCatJobsAction(), + new RestCatTrainedModelsAction(), + new RestCatDatafeedsAction() ); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestDeleteExpiredDataAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestDeleteExpiredDataAction.java index d3f024e27e854..21219ba17169f 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestDeleteExpiredDataAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestDeleteExpiredDataAction.java @@ -9,13 +9,16 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.DeleteExpiredDataAction; import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.DELETE; @@ -24,11 +27,19 @@ public class RestDeleteExpiredDataAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestDeleteExpiredDataAction.class)); - public RestDeleteExpiredDataAction(RestController controller) { + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - DELETE, MachineLearning.BASE_PATH + "_delete_expired_data", this, - DELETE, MachineLearning.PRE_V7_BASE_PATH + "_delete_expired_data", deprecationLogger); + return Collections.singletonList( + new ReplacedRestApi(DELETE, MachineLearning.BASE_PATH + "_delete_expired_data", + DELETE, MachineLearning.PRE_V7_BASE_PATH + "_delete_expired_data", + deprecationLogger) + ); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestFindFileStructureAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestFindFileStructureAction.java index b0e564095ec46..e7e528b450b5a 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestFindFileStructureAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestFindFileStructureAction.java @@ -11,8 +11,8 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.FindFileStructureAction; import org.elasticsearch.xpack.core.ml.filestructurefinder.FileStructure; @@ -21,6 +21,8 @@ import java.io.IOException; import java.util.Collections; +import java.util.List; +import java.util.Map; import java.util.Set; import java.util.concurrent.TimeUnit; @@ -33,11 +35,19 @@ public class RestFindFileStructureAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestFindFileStructureAction.class)); - public RestFindFileStructureAction(RestController controller) { + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - POST, MachineLearning.BASE_PATH + "find_file_structure", this, - POST, MachineLearning.PRE_V7_BASE_PATH + "find_file_structure", deprecationLogger); + return Collections.singletonList( + new ReplacedRestApi(POST, MachineLearning.BASE_PATH + "find_file_structure", + POST, MachineLearning.PRE_V7_BASE_PATH + "find_file_structure", + deprecationLogger) + ); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestMlInfoAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestMlInfoAction.java index 1d775d156edea..7f4c17340cf54 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestMlInfoAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestMlInfoAction.java @@ -9,13 +9,16 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.MlInfoAction; import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.GET; @@ -24,11 +27,19 @@ public class RestMlInfoAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestMlInfoAction.class)); - public RestMlInfoAction(RestController controller) { + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - GET, MachineLearning.BASE_PATH + "info", this, - GET, MachineLearning.PRE_V7_BASE_PATH + "info", deprecationLogger); + return Collections.singletonList( + new ReplacedRestApi(GET, MachineLearning.BASE_PATH + "info", + GET, MachineLearning.PRE_V7_BASE_PATH + "info", + deprecationLogger) + ); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestSetUpgradeModeAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestSetUpgradeModeAction.java index 1d8d28a4d448b..cb90b30f8b365 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestSetUpgradeModeAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestSetUpgradeModeAction.java @@ -9,13 +9,16 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.SetUpgradeModeAction; import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -24,11 +27,19 @@ public class RestSetUpgradeModeAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestSetUpgradeModeAction.class)); - public RestSetUpgradeModeAction(RestController controller) { + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - POST, MachineLearning.BASE_PATH + "set_upgrade_mode", this, - POST, MachineLearning.PRE_V7_BASE_PATH + "set_upgrade_mode", deprecationLogger); + return Collections.singletonList( + new ReplacedRestApi(POST, MachineLearning.BASE_PATH + "set_upgrade_mode", + POST, MachineLearning.PRE_V7_BASE_PATH + "set_upgrade_mode", + deprecationLogger) + ); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestDeleteCalendarAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestDeleteCalendarAction.java index 95ec620e0177a..207b67bd32ba1 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestDeleteCalendarAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestDeleteCalendarAction.java @@ -9,14 +9,17 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.DeleteCalendarAction; import org.elasticsearch.xpack.core.ml.calendars.Calendar; import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.DELETE; @@ -25,11 +28,18 @@ public class RestDeleteCalendarAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestDeleteCalendarAction.class)); - public RestDeleteCalendarAction(RestController controller) { + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - DELETE, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}", this, - DELETE, MachineLearning.PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}", deprecationLogger); + return Collections.singletonList( + new ReplacedRestApi(DELETE, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}", + DELETE, MachineLearning.PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}", deprecationLogger) + ); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestDeleteCalendarEventAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestDeleteCalendarEventAction.java index da30978461d9b..745c4d3c41ed1 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestDeleteCalendarEventAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestDeleteCalendarEventAction.java @@ -9,8 +9,8 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.DeleteCalendarEventAction; import org.elasticsearch.xpack.core.ml.calendars.Calendar; @@ -18,6 +18,9 @@ import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.DELETE; @@ -26,13 +29,20 @@ public class RestDeleteCalendarEventAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestDeleteCalendarEventAction.class)); - public RestDeleteCalendarEventAction(RestController controller) { + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - DELETE, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/events/{" + - ScheduledEvent.EVENT_ID.getPreferredName() + "}", this, - DELETE, MachineLearning.PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/events/{" + - ScheduledEvent.EVENT_ID.getPreferredName() + "}", deprecationLogger); + return Collections.singletonList( + new ReplacedRestApi(DELETE, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/events/{" + + ScheduledEvent.EVENT_ID.getPreferredName() + "}", + DELETE, MachineLearning.PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/events/{" + + ScheduledEvent.EVENT_ID.getPreferredName() + "}", deprecationLogger) + ); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestDeleteCalendarJobAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestDeleteCalendarJobAction.java index 213d3f712f961..0c71432e17200 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestDeleteCalendarJobAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestDeleteCalendarJobAction.java @@ -9,8 +9,8 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.UpdateCalendarJobAction; import org.elasticsearch.xpack.core.ml.calendars.Calendar; @@ -18,6 +18,9 @@ import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.DELETE; @@ -26,13 +29,20 @@ public class RestDeleteCalendarJobAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestDeleteCalendarJobAction.class)); - public RestDeleteCalendarJobAction(RestController controller) { + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - DELETE, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/jobs/{" + - Job.ID.getPreferredName() + "}", this, - DELETE, MachineLearning.PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/jobs/{" + - Job.ID.getPreferredName() + "}", deprecationLogger); + return Collections.singletonList( + new ReplacedRestApi(DELETE, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/jobs/{" + + Job.ID.getPreferredName() + "}", + DELETE, MachineLearning.PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/jobs/{" + + Job.ID.getPreferredName() + "}", deprecationLogger) + ); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestGetCalendarEventsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestGetCalendarEventsAction.java index c299d23ac58fe..215a96c25aaa9 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestGetCalendarEventsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestGetCalendarEventsAction.java @@ -10,8 +10,8 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.action.util.PageParams; import org.elasticsearch.xpack.core.ml.action.GetCalendarEventsAction; @@ -20,6 +20,9 @@ import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.GET; @@ -28,11 +31,18 @@ public class RestGetCalendarEventsAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestGetCalendarEventsAction.class)); - public RestGetCalendarEventsAction(RestController controller) { + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - GET, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/events", this, - GET, MachineLearning.PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/events", deprecationLogger); + return Collections.singletonList( + new ReplacedRestApi(GET, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/events", + GET, MachineLearning.PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/events", deprecationLogger) + ); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestGetCalendarsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestGetCalendarsAction.java index 46e4d23cd6846..16e8f63bfdb32 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestGetCalendarsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestGetCalendarsAction.java @@ -11,8 +11,8 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestStatusToXContentListener; import org.elasticsearch.xpack.core.action.util.PageParams; import org.elasticsearch.xpack.core.ml.action.GetCalendarsAction; @@ -20,6 +20,10 @@ import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -29,22 +33,24 @@ public class RestGetCalendarsAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestGetCalendarsAction.class)); - public RestGetCalendarsAction(RestController controller) { - // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - GET, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}", this, - GET, MachineLearning.PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}", deprecationLogger); - controller.registerWithDeprecatedHandler( - GET, MachineLearning.BASE_PATH + "calendars/", this, - GET, MachineLearning.PRE_V7_BASE_PATH + "calendars/", deprecationLogger); + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } - // endpoints that support body parameters must also accept POST - controller.registerWithDeprecatedHandler( - POST, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}", this, - POST, MachineLearning.PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}", deprecationLogger); - controller.registerWithDeprecatedHandler( - POST, MachineLearning.BASE_PATH + "calendars/", this, - POST, MachineLearning.PRE_V7_BASE_PATH + "calendars/", deprecationLogger); + @Override + public List replacedMethodsAndPaths() { + // TODO: remove deprecated endpoint in 8.0.0 + return Collections.unmodifiableList(Arrays.asList( + new ReplacedRestApi(GET, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}", + GET, MachineLearning.PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}", deprecationLogger), + new ReplacedRestApi(GET, MachineLearning.BASE_PATH + "calendars/", + GET, MachineLearning.PRE_V7_BASE_PATH + "calendars/", deprecationLogger), + new ReplacedRestApi(POST, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}", + POST, MachineLearning.PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}", deprecationLogger), + new ReplacedRestApi(POST, MachineLearning.BASE_PATH + "calendars/", + POST, MachineLearning.PRE_V7_BASE_PATH + "calendars/", deprecationLogger) + )); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestPostCalendarEventAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestPostCalendarEventAction.java index 5ad91ffd92fc2..bb1a52231062a 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestPostCalendarEventAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestPostCalendarEventAction.java @@ -10,14 +10,17 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.PostCalendarEventsAction; import org.elasticsearch.xpack.core.ml.calendars.Calendar; import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -26,11 +29,18 @@ public class RestPostCalendarEventAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestPostCalendarEventAction.class)); - public RestPostCalendarEventAction(RestController controller) { + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - POST, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/events", this, - POST, MachineLearning.PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/events", deprecationLogger); + return Collections.singletonList( + new ReplacedRestApi(POST, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/events", + POST, MachineLearning.PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/events", deprecationLogger) + ); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestPutCalendarAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestPutCalendarAction.java index 553bb81cbf900..d75c43b8854df 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestPutCalendarAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestPutCalendarAction.java @@ -10,15 +10,17 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; -import org.elasticsearch.xpack.ml.MachineLearning; import org.elasticsearch.xpack.core.ml.action.PutCalendarAction; import org.elasticsearch.xpack.core.ml.calendars.Calendar; +import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.PUT; @@ -27,11 +29,18 @@ public class RestPutCalendarAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestPutCalendarAction.class)); - public RestPutCalendarAction(RestController controller) { + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - PUT, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}", this, - PUT, MachineLearning.PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}", deprecationLogger); + return Collections.singletonList( + new ReplacedRestApi(PUT, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}", + PUT, MachineLearning.PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}", deprecationLogger) + ); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestPutCalendarJobAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestPutCalendarJobAction.java index ce47bc3a53a1d..8201c006b1bf3 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestPutCalendarJobAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestPutCalendarJobAction.java @@ -9,8 +9,8 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.UpdateCalendarJobAction; import org.elasticsearch.xpack.core.ml.calendars.Calendar; @@ -18,6 +18,9 @@ import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.PUT; @@ -26,13 +29,22 @@ public class RestPutCalendarJobAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestPutCalendarJobAction.class)); - public RestPutCalendarJobAction(RestController controller) { + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - PUT, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/jobs/{" + - Job.ID.getPreferredName() + "}", this, - PUT, MachineLearning.PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/jobs/{" + - Job.ID.getPreferredName() + "}", deprecationLogger); + return Collections.singletonList( + new ReplacedRestApi(PUT, + MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/jobs/{" + Job.ID.getPreferredName() + "}", + PUT, + MachineLearning.PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/jobs/{" + + Job.ID.getPreferredName() + "}", + deprecationLogger) + ); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/cat/RestCatDatafeedsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/cat/RestCatDatafeedsAction.java index 2af29f9b30f89..0d6301c8efef6 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/cat/RestCatDatafeedsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/cat/RestCatDatafeedsAction.java @@ -9,9 +9,10 @@ import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.common.Strings; import org.elasticsearch.common.Table; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.unit.TimeValue; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestResponseListener; import org.elasticsearch.rest.action.cat.AbstractCatAction; @@ -20,13 +21,21 @@ import org.elasticsearch.xpack.core.ml.datafeed.DatafeedConfig; import org.elasticsearch.xpack.core.ml.datafeed.DatafeedTimingStats; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestCatDatafeedsAction extends AbstractCatAction { - public RestCatDatafeedsAction(RestController controller) { - controller.registerHandler(GET, "_cat/ml/datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}", this); - controller.registerHandler(GET, "_cat/ml/datafeeds", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("_cat/ml/datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}", singletonList(GET)) + .put("_cat/ml/datafeeds", singletonList(GET)) + .map()); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/cat/RestCatJobsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/cat/RestCatJobsAction.java index 7d42e1b55f315..5596ddf8ddd21 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/cat/RestCatJobsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/cat/RestCatJobsAction.java @@ -10,10 +10,11 @@ import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.common.Strings; import org.elasticsearch.common.Table; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.common.unit.TimeValue; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestResponseListener; import org.elasticsearch.rest.action.cat.AbstractCatAction; @@ -25,13 +26,21 @@ import org.elasticsearch.xpack.core.ml.job.process.autodetect.state.TimingStats; import org.elasticsearch.xpack.core.ml.stats.ForecastStats; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestCatJobsAction extends AbstractCatAction { - public RestCatJobsAction(RestController controller) { - controller.registerHandler(GET, "_cat/ml/anomaly_detectors/{" + Job.ID.getPreferredName() + "}", this); - controller.registerHandler(GET, "_cat/ml/anomaly_detectors", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("_cat/ml/anomaly_detectors/{" + Job.ID.getPreferredName() + "}", singletonList(GET)) + .put("_cat/ml/anomaly_detectors", singletonList(GET)) + .map()); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/cat/RestCatTrainedModelsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/cat/RestCatTrainedModelsAction.java index 0617ba8ab3ef3..7d5ec2c1805ff 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/cat/RestCatTrainedModelsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/cat/RestCatTrainedModelsAction.java @@ -12,10 +12,11 @@ import org.elasticsearch.cluster.metadata.MetaData; import org.elasticsearch.common.Strings; import org.elasticsearch.common.Table; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.common.unit.TimeValue; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestResponseListener; import org.elasticsearch.rest.action.cat.AbstractCatAction; @@ -38,14 +39,20 @@ import java.util.function.Function; import java.util.stream.Collectors; +import static java.util.Collections.singletonList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.xpack.core.ml.action.GetTrainedModelsAction.Request.ALLOW_NO_MATCH; public class RestCatTrainedModelsAction extends AbstractCatAction { - public RestCatTrainedModelsAction(RestController controller) { - controller.registerHandler(GET, "_cat/ml/trained_models/{" + TrainedModelConfig.MODEL_ID.getPreferredName() + "}", this); - controller.registerHandler(GET, "_cat/ml/trained_models", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap( + MapBuilder.>newMapBuilder() + .put("_cat/ml/trained_models", singletonList(GET)) + .put("_cat/ml/trained_models/{" + TrainedModelConfig.MODEL_ID.getPreferredName() + "}", singletonList(GET)) + .map() + ); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestDeleteDatafeedAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestDeleteDatafeedAction.java index 000b92426d887..7c2414a62fdbf 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestDeleteDatafeedAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestDeleteDatafeedAction.java @@ -9,8 +9,8 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.CloseJobAction; import org.elasticsearch.xpack.core.ml.action.DeleteDatafeedAction; @@ -18,6 +18,9 @@ import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.DELETE; @@ -26,11 +29,18 @@ public class RestDeleteDatafeedAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestDeleteDatafeedAction.class)); - public RestDeleteDatafeedAction(RestController controller) { + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - DELETE, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}", this, - DELETE, MachineLearning.PRE_V7_BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}", deprecationLogger); + return Collections.singletonList( + new ReplacedRestApi(DELETE, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}", + DELETE, MachineLearning.PRE_V7_BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}", deprecationLogger) + ); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestGetDatafeedStatsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestGetDatafeedStatsAction.java index 65866074dfadf..c2970168f2657 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestGetDatafeedStatsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestGetDatafeedStatsAction.java @@ -10,14 +10,18 @@ import org.elasticsearch.common.Strings; import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.GetDatafeedsStatsAction; import org.elasticsearch.xpack.core.ml.datafeed.DatafeedConfig; import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.GET; @@ -26,14 +30,21 @@ public class RestGetDatafeedStatsAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestGetDatafeedStatsAction.class)); - public RestGetDatafeedStatsAction(RestController controller) { + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - GET, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_stats", this, - GET, MachineLearning.PRE_V7_BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_stats", deprecationLogger); - controller.registerWithDeprecatedHandler( - GET, MachineLearning.BASE_PATH + "datafeeds/_stats", this, - GET, MachineLearning.PRE_V7_BASE_PATH + "datafeeds/_stats", deprecationLogger); + return Collections.unmodifiableList(Arrays.asList( + new ReplacedRestApi(GET, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_stats", + GET, MachineLearning.PRE_V7_BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_stats", + deprecationLogger), + new ReplacedRestApi(GET, MachineLearning.BASE_PATH + "datafeeds/_stats", + GET, MachineLearning.PRE_V7_BASE_PATH + "datafeeds/_stats", deprecationLogger) + )); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestGetDatafeedsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestGetDatafeedsAction.java index 1ed7ce33ef887..049e9ac448360 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestGetDatafeedsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestGetDatafeedsAction.java @@ -9,14 +9,18 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.GetDatafeedsAction; import org.elasticsearch.xpack.core.ml.datafeed.DatafeedConfig; import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.GET; @@ -25,14 +29,20 @@ public class RestGetDatafeedsAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestGetDatafeedsAction.class)); - public RestGetDatafeedsAction(RestController controller) { + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - GET, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}", this, - GET, MachineLearning.PRE_V7_BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}", deprecationLogger); - controller.registerWithDeprecatedHandler( - GET, MachineLearning.BASE_PATH + "datafeeds", this, - GET, MachineLearning.PRE_V7_BASE_PATH + "datafeeds", deprecationLogger); + return Collections.unmodifiableList(Arrays.asList( + new ReplacedRestApi(GET, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}", + GET, MachineLearning.PRE_V7_BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}", deprecationLogger), + new ReplacedRestApi(GET, MachineLearning.BASE_PATH + "datafeeds", + GET, MachineLearning.PRE_V7_BASE_PATH + "datafeeds", deprecationLogger) + )); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestPreviewDatafeedAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestPreviewDatafeedAction.java index 6088f42f2d304..9344ff406652e 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestPreviewDatafeedAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestPreviewDatafeedAction.java @@ -9,14 +9,17 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.PreviewDatafeedAction; import org.elasticsearch.xpack.core.ml.datafeed.DatafeedConfig; import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.GET; @@ -25,11 +28,19 @@ public class RestPreviewDatafeedAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestPreviewDatafeedAction.class)); - public RestPreviewDatafeedAction(RestController controller) { + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - GET, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_preview", this, - GET, MachineLearning.PRE_V7_BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_preview", deprecationLogger); + return Collections.singletonList( + new ReplacedRestApi(GET, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_preview", + GET, MachineLearning.PRE_V7_BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_preview", + deprecationLogger) + ); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestPutDatafeedAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestPutDatafeedAction.java index 12e8863f68124..ed4e41bfcc9ff 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestPutDatafeedAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestPutDatafeedAction.java @@ -10,14 +10,17 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.PutDatafeedAction; import org.elasticsearch.xpack.core.ml.datafeed.DatafeedConfig; import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.PUT; @@ -26,11 +29,19 @@ public class RestPutDatafeedAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestPutDatafeedAction.class)); - public RestPutDatafeedAction(RestController controller) { + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - PUT, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}", this, - PUT, MachineLearning.PRE_V7_BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}", deprecationLogger); + return Collections.singletonList( + new ReplacedRestApi(PUT, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}", + PUT, MachineLearning.PRE_V7_BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}", + deprecationLogger) + ); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestStartDatafeedAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestStartDatafeedAction.java index 3dbe4ceb10055..7b024e9528f98 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestStartDatafeedAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestStartDatafeedAction.java @@ -14,8 +14,8 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -24,6 +24,9 @@ import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -34,11 +37,19 @@ public class RestStartDatafeedAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestStartDatafeedAction.class)); - public RestStartDatafeedAction(RestController controller) { + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - POST, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_start", this, - POST, MachineLearning.PRE_V7_BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_start", deprecationLogger); + return Collections.singletonList( + new ReplacedRestApi(POST, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_start", + POST, MachineLearning.PRE_V7_BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_start", + deprecationLogger) + ); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestStopDatafeedAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestStopDatafeedAction.java index f1cc37e61a88d..2a51c22582686 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestStopDatafeedAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestStopDatafeedAction.java @@ -13,8 +13,8 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -24,6 +24,9 @@ import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -32,11 +35,19 @@ public class RestStopDatafeedAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestStopDatafeedAction.class)); - public RestStopDatafeedAction(RestController controller) { + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - POST, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_stop", this, - POST, MachineLearning.PRE_V7_BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_stop", deprecationLogger); + return Collections.singletonList( + new ReplacedRestApi(POST, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_stop", + POST, MachineLearning.PRE_V7_BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_stop", + deprecationLogger) + ); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestUpdateDatafeedAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestUpdateDatafeedAction.java index b36eb5e0078f8..1b116373bea85 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestUpdateDatafeedAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestUpdateDatafeedAction.java @@ -10,14 +10,17 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.UpdateDatafeedAction; import org.elasticsearch.xpack.core.ml.datafeed.DatafeedConfig; import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -26,11 +29,19 @@ public class RestUpdateDatafeedAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestUpdateDatafeedAction.class)); - public RestUpdateDatafeedAction(RestController controller) { + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - POST, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_update", this, - POST, MachineLearning.PRE_V7_BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_update", deprecationLogger); + return Collections.singletonList( + new ReplacedRestApi(POST, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_update", + POST, MachineLearning.PRE_V7_BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_update", + deprecationLogger) + ); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestDeleteDataFrameAnalyticsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestDeleteDataFrameAnalyticsAction.java index 9e78a7cd9f214..2d0b5070e7454 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestDeleteDataFrameAnalyticsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestDeleteDataFrameAnalyticsAction.java @@ -7,20 +7,28 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.DeleteDataFrameAnalyticsAction; import org.elasticsearch.xpack.core.ml.dataframe.DataFrameAnalyticsConfig; import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.DELETE; public class RestDeleteDataFrameAnalyticsAction extends BaseRestHandler { - public RestDeleteDataFrameAnalyticsAction(RestController controller) { - controller.registerHandler(RestRequest.Method.DELETE, MachineLearning.BASE_PATH + "data_frame/analytics/{" - + DataFrameAnalyticsConfig.ID.getPreferredName() + "}", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap( + MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}", + singletonList(DELETE)); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestEvaluateDataFrameAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestEvaluateDataFrameAction.java index b991fec70e581..6e941be775133 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestEvaluateDataFrameAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestEvaluateDataFrameAction.java @@ -7,18 +7,25 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.EvaluateDataFrameAction; import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestEvaluateDataFrameAction extends BaseRestHandler { - public RestEvaluateDataFrameAction(RestController controller) { - controller.registerHandler(RestRequest.Method.POST, MachineLearning.BASE_PATH + "data_frame/_evaluate", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap(MachineLearning.BASE_PATH + "data_frame/_evaluate", singletonList(POST)); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestExplainDataFrameAnalyticsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestExplainDataFrameAnalyticsAction.java index b16bf7b3efbf1..b3d54873f7e26 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestExplainDataFrameAnalyticsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestExplainDataFrameAnalyticsAction.java @@ -8,9 +8,10 @@ import org.elasticsearch.action.ActionListener; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.ExplainDataFrameAnalyticsAction; import org.elasticsearch.xpack.core.ml.action.GetDataFrameAnalyticsAction; @@ -20,18 +21,25 @@ import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.Collections; import java.util.List; +import java.util.Map; import java.util.stream.Collectors; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; +import static org.elasticsearch.rest.RestRequest.Method.GET; +import static org.elasticsearch.rest.RestRequest.Method.POST; + public class RestExplainDataFrameAnalyticsAction extends BaseRestHandler { - public RestExplainDataFrameAnalyticsAction(RestController controller) { - controller.registerHandler(RestRequest.Method.GET, MachineLearning.BASE_PATH + "data_frame/analytics/_explain", this); - controller.registerHandler(RestRequest.Method.POST, MachineLearning.BASE_PATH + "data_frame/analytics/_explain", this); - controller.registerHandler(RestRequest.Method.GET, MachineLearning.BASE_PATH + "data_frame/analytics/{" - + DataFrameAnalyticsConfig.ID.getPreferredName() + "}/_explain", this); - controller.registerHandler(RestRequest.Method.POST, MachineLearning.BASE_PATH + "data_frame/analytics/{" - + DataFrameAnalyticsConfig.ID.getPreferredName() + "}/_explain", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put(MachineLearning.BASE_PATH + "data_frame/analytics/_explain", unmodifiableList(asList(GET, POST))) + .put(MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}/_explain", + unmodifiableList(asList(GET, POST))) + .map()); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestGetDataFrameAnalyticsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestGetDataFrameAnalyticsAction.java index 3c959056b2a5a..b8355f5e4a2c3 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestGetDataFrameAnalyticsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestGetDataFrameAnalyticsAction.java @@ -7,9 +7,10 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.action.util.PageParams; import org.elasticsearch.xpack.core.ml.action.GetDataFrameAnalyticsAction; @@ -17,13 +18,22 @@ import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestGetDataFrameAnalyticsAction extends BaseRestHandler { - public RestGetDataFrameAnalyticsAction(RestController controller) { - controller.registerHandler(RestRequest.Method.GET, MachineLearning.BASE_PATH + "data_frame/analytics", this); - controller.registerHandler(RestRequest.Method.GET, MachineLearning.BASE_PATH + "data_frame/analytics/{" - + DataFrameAnalyticsConfig.ID.getPreferredName() + "}", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put(MachineLearning.BASE_PATH + "data_frame/analytics", singletonList(GET)) + .put(MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}", + singletonList(GET)) + .map()); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestGetDataFrameAnalyticsStatsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestGetDataFrameAnalyticsStatsAction.java index 44d43153e75b6..624ffb0b7a0e0 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestGetDataFrameAnalyticsStatsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestGetDataFrameAnalyticsStatsAction.java @@ -7,9 +7,10 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.action.util.PageParams; import org.elasticsearch.xpack.core.ml.action.GetDataFrameAnalyticsStatsAction; @@ -17,13 +18,22 @@ import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestGetDataFrameAnalyticsStatsAction extends BaseRestHandler { - public RestGetDataFrameAnalyticsStatsAction(RestController controller) { - controller.registerHandler(RestRequest.Method.GET, MachineLearning.BASE_PATH + "data_frame/analytics/_stats", this); - controller.registerHandler(RestRequest.Method.GET, MachineLearning.BASE_PATH + "data_frame/analytics/{" - + DataFrameAnalyticsConfig.ID.getPreferredName() + "}/_stats", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put(MachineLearning.BASE_PATH + "data_frame/analytics/_stats", singletonList(GET)) + .put(MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}/_stats", + singletonList(GET)) + .map()); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestPutDataFrameAnalyticsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestPutDataFrameAnalyticsAction.java index 11a25e76a6c11..1ff5bf44e1db4 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestPutDataFrameAnalyticsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestPutDataFrameAnalyticsAction.java @@ -8,20 +8,27 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.PutDataFrameAnalyticsAction; import org.elasticsearch.xpack.core.ml.dataframe.DataFrameAnalyticsConfig; import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.PUT; public class RestPutDataFrameAnalyticsAction extends BaseRestHandler { - public RestPutDataFrameAnalyticsAction(RestController controller) { - controller.registerHandler(RestRequest.Method.PUT, MachineLearning.BASE_PATH + "data_frame/analytics/{" - + DataFrameAnalyticsConfig.ID.getPreferredName() + "}", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap(MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}", + singletonList(PUT)); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestStartDataFrameAnalyticsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestStartDataFrameAnalyticsAction.java index df98e7bc402f1..0a30ee11dbf4a 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestStartDataFrameAnalyticsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestStartDataFrameAnalyticsAction.java @@ -8,20 +8,28 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.StartDataFrameAnalyticsAction; import org.elasticsearch.xpack.core.ml.dataframe.DataFrameAnalyticsConfig; import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestStartDataFrameAnalyticsAction extends BaseRestHandler { - public RestStartDataFrameAnalyticsAction(RestController controller) { - controller.registerHandler(RestRequest.Method.POST, MachineLearning.BASE_PATH + "data_frame/analytics/{" - + DataFrameAnalyticsConfig.ID.getPreferredName() + "}/_start", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap( + MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}/_start", + singletonList(POST)); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestStopDataFrameAnalyticsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestStopDataFrameAnalyticsAction.java index aadc11a659d56..9c85c786b7f99 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestStopDataFrameAnalyticsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestStopDataFrameAnalyticsAction.java @@ -7,20 +7,28 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.StopDataFrameAnalyticsAction; import org.elasticsearch.xpack.core.ml.dataframe.DataFrameAnalyticsConfig; import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestStopDataFrameAnalyticsAction extends BaseRestHandler { - public RestStopDataFrameAnalyticsAction(RestController controller) { - controller.registerHandler(RestRequest.Method.POST, MachineLearning.BASE_PATH + "data_frame/analytics/{" - + DataFrameAnalyticsConfig.ID.getPreferredName() + "}/_stop", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap( + MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}/_stop", + singletonList(POST)); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestDeleteFilterAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestDeleteFilterAction.java index cee5745866148..fc82939bb49ca 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestDeleteFilterAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestDeleteFilterAction.java @@ -9,14 +9,17 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.DeleteFilterAction; import org.elasticsearch.xpack.core.ml.action.DeleteFilterAction.Request; import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.DELETE; @@ -25,11 +28,19 @@ public class RestDeleteFilterAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestDeleteFilterAction.class)); - public RestDeleteFilterAction(RestController controller) { + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - DELETE, MachineLearning.BASE_PATH + "filters/{" + Request.FILTER_ID.getPreferredName() + "}", this, - DELETE, MachineLearning.PRE_V7_BASE_PATH + "filters/{" + Request.FILTER_ID.getPreferredName() + "}", deprecationLogger); + return Collections.singletonList( + new ReplacedRestApi(DELETE, MachineLearning.BASE_PATH + "filters/{" + Request.FILTER_ID.getPreferredName() + "}", + DELETE, MachineLearning.PRE_V7_BASE_PATH + "filters/{" + Request.FILTER_ID.getPreferredName() + "}", + deprecationLogger) + ); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestGetFiltersAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestGetFiltersAction.java index 558da54b7f374..34ec24f441b45 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestGetFiltersAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestGetFiltersAction.java @@ -10,8 +10,8 @@ import org.elasticsearch.common.Strings; import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestStatusToXContentListener; import org.elasticsearch.xpack.core.action.util.PageParams; import org.elasticsearch.xpack.core.ml.action.GetFiltersAction; @@ -19,6 +19,10 @@ import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.GET; @@ -27,14 +31,22 @@ public class RestGetFiltersAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestGetFiltersAction.class)); - public RestGetFiltersAction(RestController controller) { + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - GET, MachineLearning.BASE_PATH + "filters/{" + MlFilter.ID.getPreferredName() + "}", this, - GET, MachineLearning.PRE_V7_BASE_PATH + "filters/{" + MlFilter.ID.getPreferredName() + "}", deprecationLogger); - controller.registerWithDeprecatedHandler( - GET, MachineLearning.BASE_PATH + "filters/", this, - GET, MachineLearning.PRE_V7_BASE_PATH + "filters/", deprecationLogger); + return Collections.unmodifiableList(Arrays.asList( + new ReplacedRestApi(GET, MachineLearning.BASE_PATH + "filters/{" + MlFilter.ID.getPreferredName() + "}", + GET, MachineLearning.PRE_V7_BASE_PATH + "filters/{" + MlFilter.ID.getPreferredName() + "}", + deprecationLogger), + new ReplacedRestApi(GET, MachineLearning.BASE_PATH + "filters/", + GET, MachineLearning.PRE_V7_BASE_PATH + "filters/", + deprecationLogger) + )); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestPutFilterAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestPutFilterAction.java index b902c09985382..a5430d9e1ae56 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestPutFilterAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestPutFilterAction.java @@ -10,14 +10,17 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.PutFilterAction; import org.elasticsearch.xpack.core.ml.job.config.MlFilter; import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.PUT; @@ -26,11 +29,19 @@ public class RestPutFilterAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestPutFilterAction.class)); - public RestPutFilterAction(RestController controller) { + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - PUT, MachineLearning.BASE_PATH + "filters/{" + MlFilter.ID.getPreferredName() + "}", this, - PUT, MachineLearning.PRE_V7_BASE_PATH + "filters/{" + MlFilter.ID.getPreferredName() + "}", deprecationLogger); + return Collections.singletonList( + new ReplacedRestApi(PUT, MachineLearning.BASE_PATH + "filters/{" + MlFilter.ID.getPreferredName() + "}", + PUT, MachineLearning.PRE_V7_BASE_PATH + "filters/{" + MlFilter.ID.getPreferredName() + "}", + deprecationLogger) + ); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestUpdateFilterAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestUpdateFilterAction.java index b9c544f30c217..74542572facf1 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestUpdateFilterAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestUpdateFilterAction.java @@ -10,14 +10,17 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.UpdateFilterAction; import org.elasticsearch.xpack.core.ml.job.config.MlFilter; import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -26,11 +29,19 @@ public class RestUpdateFilterAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestUpdateFilterAction.class)); - public RestUpdateFilterAction(RestController controller) { + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - POST, MachineLearning.BASE_PATH + "filters/{" + MlFilter.ID.getPreferredName() + "}/_update", this, - POST, MachineLearning.PRE_V7_BASE_PATH + "filters/{" + MlFilter.ID.getPreferredName() + "}/_update", deprecationLogger); + return Collections.singletonList( + new ReplacedRestApi(POST, MachineLearning.BASE_PATH + "filters/{" + MlFilter.ID.getPreferredName() + "}/_update", + POST, MachineLearning.PRE_V7_BASE_PATH + "filters/{" + MlFilter.ID.getPreferredName() + "}/_update", + deprecationLogger) + ); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestDeleteTrainedModelAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestDeleteTrainedModelAction.java index e9675be4d29fd..e8af002b04f59 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestDeleteTrainedModelAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestDeleteTrainedModelAction.java @@ -7,22 +7,27 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.DeleteTrainedModelAction; import org.elasticsearch.xpack.core.ml.inference.TrainedModelConfig; import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.List; +import java.util.Map; +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.DELETE; public class RestDeleteTrainedModelAction extends BaseRestHandler { - public RestDeleteTrainedModelAction(RestController controller) { - controller.registerHandler( - DELETE, MachineLearning.BASE_PATH + "inference/{" + TrainedModelConfig.MODEL_ID.getPreferredName() + "}", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap(MachineLearning.BASE_PATH + "inference/{" + TrainedModelConfig.MODEL_ID.getPreferredName() + "}", + singletonList(DELETE)); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestGetTrainedModelsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestGetTrainedModelsAction.java index 4d818f974f74e..3922df6ff67ae 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestGetTrainedModelsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestGetTrainedModelsAction.java @@ -8,9 +8,10 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.cluster.metadata.MetaData; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.action.util.PageParams; import org.elasticsearch.xpack.core.ml.action.GetTrainedModelsAction; @@ -21,17 +22,21 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; +import java.util.Map; import java.util.Set; +import static java.util.Collections.singletonList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.xpack.core.ml.action.GetTrainedModelsAction.Request.ALLOW_NO_MATCH; public class RestGetTrainedModelsAction extends BaseRestHandler { - public RestGetTrainedModelsAction(RestController controller) { - controller.registerHandler( - GET, MachineLearning.BASE_PATH + "inference/{" + TrainedModelConfig.MODEL_ID.getPreferredName() + "}", this); - controller.registerHandler(GET, MachineLearning.BASE_PATH + "inference", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put(MachineLearning.BASE_PATH + "inference/{" + TrainedModelConfig.MODEL_ID.getPreferredName() + "}", singletonList(GET)) + .put(MachineLearning.BASE_PATH + MachineLearning.BASE_PATH + "inference", singletonList(GET)) + .map()); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestGetTrainedModelsStatsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestGetTrainedModelsStatsAction.java index 100c8cfa2f922..826a5702fa148 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestGetTrainedModelsStatsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestGetTrainedModelsStatsAction.java @@ -8,9 +8,10 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.cluster.metadata.MetaData; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.action.util.PageParams; import org.elasticsearch.xpack.core.ml.action.GetTrainedModelsStatsAction; @@ -18,16 +19,23 @@ import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import static java.util.Collections.singletonList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.xpack.core.ml.action.GetTrainedModelsAction.Request.ALLOW_NO_MATCH; public class RestGetTrainedModelsStatsAction extends BaseRestHandler { - public RestGetTrainedModelsStatsAction(RestController controller) { - controller.registerHandler( - GET, MachineLearning.BASE_PATH + "inference/{" + TrainedModelConfig.MODEL_ID.getPreferredName() + "}/_stats", this); - controller.registerHandler(GET, MachineLearning.BASE_PATH + "inference/_stats", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put(MachineLearning.BASE_PATH + "inference/{" + TrainedModelConfig.MODEL_ID.getPreferredName() + "}/_stats", + singletonList(GET)) + .put(MachineLearning.BASE_PATH + MachineLearning.BASE_PATH + "inference/_stats", singletonList(GET)) + .map()); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestPutTrainedModelAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestPutTrainedModelAction.java index cb3f4e0eddee2..846f5f7b11fd1 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestPutTrainedModelAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestPutTrainedModelAction.java @@ -8,21 +8,27 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.PutTrainedModelAction; import org.elasticsearch.xpack.core.ml.inference.TrainedModelConfig; import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.PUT; public class RestPutTrainedModelAction extends BaseRestHandler { - public RestPutTrainedModelAction(RestController controller) { - controller.registerHandler(RestRequest.Method.PUT, - MachineLearning.BASE_PATH + "inference/{" + TrainedModelConfig.MODEL_ID.getPreferredName() + "}", - this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap(MachineLearning.BASE_PATH + "inference/{" + TrainedModelConfig.MODEL_ID.getPreferredName() + "}", + singletonList(PUT)); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestCloseJobAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestCloseJobAction.java index 9e8a2eaf7a35a..c7487860b6a5d 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestCloseJobAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestCloseJobAction.java @@ -10,8 +10,8 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.CloseJobAction; import org.elasticsearch.xpack.core.ml.action.CloseJobAction.Request; @@ -19,6 +19,9 @@ import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -27,11 +30,18 @@ public class RestCloseJobAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestCloseJobAction.class)); - public RestCloseJobAction(RestController controller) { + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_close", this, - POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_close", deprecationLogger); + return Collections.singletonList( + new ReplacedRestApi(POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_close", + POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_close", deprecationLogger) + ); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestDeleteForecastAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestDeleteForecastAction.java index 61b15f7794cd5..dbc0374997a04 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestDeleteForecastAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestDeleteForecastAction.java @@ -10,8 +10,8 @@ import org.elasticsearch.cluster.metadata.MetaData; import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.DeleteForecastAction; import org.elasticsearch.xpack.core.ml.job.config.Job; @@ -19,7 +19,11 @@ import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.List; +import java.util.Map; +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.DELETE; public class RestDeleteForecastAction extends BaseRestHandler { @@ -27,16 +31,21 @@ public class RestDeleteForecastAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestDeleteForecastAction.class)); - public RestDeleteForecastAction(RestController controller) { + @Override + public Map> handledMethodsAndPaths() { + return singletonMap(MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_forecast/", + singletonList(DELETE)); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - DELETE, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + - "}/_forecast/{" + Forecast.FORECAST_ID.getPreferredName() + "}", this, - DELETE, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + - "}/_forecast/{" + Forecast.FORECAST_ID.getPreferredName() + "}", deprecationLogger); - controller.registerHandler( - DELETE, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + - "}/_forecast/", this); + return singletonList( + new ReplacedRestApi(DELETE, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + + "}/_forecast/{" + Forecast.FORECAST_ID.getPreferredName() + "}", + DELETE, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + + "}/_forecast/{" + Forecast.FORECAST_ID.getPreferredName() + "}", deprecationLogger) + ); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestDeleteJobAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestDeleteJobAction.java index 9f8aed81b6b1b..d259aff0664d7 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestDeleteJobAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestDeleteJobAction.java @@ -11,8 +11,8 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.tasks.Task; @@ -23,6 +23,9 @@ import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.DELETE; @@ -31,11 +34,18 @@ public class RestDeleteJobAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestDeleteJobAction.class)); - public RestDeleteJobAction(RestController controller) { + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - DELETE, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}", this, - DELETE, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}", deprecationLogger); + return Collections.singletonList( + new ReplacedRestApi(DELETE, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}", + DELETE, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}", deprecationLogger) + ); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestFlushJobAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestFlushJobAction.java index a1e6d09285a1c..54953a5dafd8e 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestFlushJobAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestFlushJobAction.java @@ -10,14 +10,17 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.FlushJobAction; import org.elasticsearch.xpack.core.ml.job.config.Job; import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -32,11 +35,19 @@ public class RestFlushJobAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestFlushJobAction.class)); - public RestFlushJobAction(RestController controller) { + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_flush", this, - POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_flush", deprecationLogger); + return Collections.singletonList( + new ReplacedRestApi(POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_flush", + POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_flush", + deprecationLogger) + ); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestForecastJobAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestForecastJobAction.java index 12c508daceecd..af59241987f98 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestForecastJobAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestForecastJobAction.java @@ -10,14 +10,17 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.ForecastJobAction; import org.elasticsearch.xpack.core.ml.job.config.Job; import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -26,11 +29,19 @@ public class RestForecastJobAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestForecastJobAction.class)); - public RestForecastJobAction(RestController controller) { + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_forecast", this, - POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_forecast", deprecationLogger); + return Collections.singletonList( + new ReplacedRestApi(POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_forecast", + POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_forecast", + deprecationLogger) + ); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestGetJobStatsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestGetJobStatsAction.java index 16b540d04fdd8..ec447cca9bdc7 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestGetJobStatsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestGetJobStatsAction.java @@ -11,14 +11,18 @@ import org.elasticsearch.common.Strings; import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.GetJobsStatsAction; import org.elasticsearch.xpack.core.ml.job.config.Job; import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.GET; @@ -27,14 +31,21 @@ public class RestGetJobStatsAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestGetJobStatsAction.class)); - public RestGetJobStatsAction(RestController controller) { + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_stats", this, - GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_stats", deprecationLogger); - controller.registerWithDeprecatedHandler( - GET, MachineLearning.BASE_PATH + "anomaly_detectors/_stats", this, - GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/_stats", deprecationLogger); + return Collections.unmodifiableList(Arrays.asList( + new ReplacedRestApi(GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_stats", + GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_stats", + deprecationLogger), + new ReplacedRestApi(GET, MachineLearning.BASE_PATH + "anomaly_detectors/_stats", + GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/_stats", deprecationLogger) + )); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestGetJobsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestGetJobsAction.java index 5c9bc48400226..b1da929ce22a4 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestGetJobsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestGetJobsAction.java @@ -11,14 +11,18 @@ import org.elasticsearch.common.Strings; import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.GetJobsAction; import org.elasticsearch.xpack.core.ml.job.config.Job; import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.GET; @@ -27,14 +31,21 @@ public class RestGetJobsAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestGetJobsAction.class)); - public RestGetJobsAction(RestController controller) { + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}", this, - GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}", deprecationLogger); - controller.registerWithDeprecatedHandler( - GET, MachineLearning.BASE_PATH + "anomaly_detectors", this, - GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors", deprecationLogger); + return Collections.unmodifiableList(Arrays.asList( + new ReplacedRestApi(GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}", + GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}", + deprecationLogger), + new ReplacedRestApi(GET, MachineLearning.BASE_PATH + "anomaly_detectors", + GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors", deprecationLogger) + )); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestOpenJobAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestOpenJobAction.java index 4e6b02049be59..09f4cdb30c367 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestOpenJobAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestOpenJobAction.java @@ -13,8 +13,8 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -23,19 +23,30 @@ import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; -import static org.elasticsearch.rest.RestRequest.Method.POST; +import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestOpenJobAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestOpenJobAction.class)); - public RestOpenJobAction(RestController controller) { + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_open", this, - POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_open", deprecationLogger); + return Collections.singletonList( + new ReplacedRestApi(GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_open", + GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_open", + deprecationLogger) + ); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPostDataAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPostDataAction.java index b3e57ca5855a5..21d0a690d4ed4 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPostDataAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPostDataAction.java @@ -9,14 +9,17 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestStatusToXContentListener; import org.elasticsearch.xpack.core.ml.action.PostDataAction; import org.elasticsearch.xpack.core.ml.job.config.Job; import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -28,11 +31,19 @@ public class RestPostDataAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestPostDataAction.class)); - public RestPostDataAction(RestController controller) { + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_data", this, - POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_data", deprecationLogger); + return Collections.singletonList( + new ReplacedRestApi(POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_data", + POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_data", + deprecationLogger) + ); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPostJobUpdateAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPostJobUpdateAction.java index a237a8b187459..002d35f9a217d 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPostJobUpdateAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPostJobUpdateAction.java @@ -10,14 +10,17 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.UpdateJobAction; import org.elasticsearch.xpack.core.ml.job.config.Job; import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -26,11 +29,19 @@ public class RestPostJobUpdateAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestPostJobUpdateAction.class)); - public RestPostJobUpdateAction(RestController controller) { + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_update", this, - POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_update", deprecationLogger); + return Collections.singletonList( + new ReplacedRestApi(POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_update", + POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_update", + deprecationLogger) + ); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPutJobAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPutJobAction.java index fe0e29cde490c..25f697ed89cc2 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPutJobAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPutJobAction.java @@ -10,14 +10,17 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.PutJobAction; import org.elasticsearch.xpack.core.ml.job.config.Job; import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.PUT; @@ -26,11 +29,19 @@ public class RestPutJobAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestPutJobAction.class)); - public RestPutJobAction(RestController controller) { + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - PUT, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}", this, - PUT, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}", deprecationLogger); + return Collections.singletonList( + new ReplacedRestApi(PUT, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}", + PUT, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}", + deprecationLogger) + ); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestDeleteModelSnapshotAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestDeleteModelSnapshotAction.java index 7ea082f9fd12f..60cf3d12ebea9 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestDeleteModelSnapshotAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestDeleteModelSnapshotAction.java @@ -9,15 +9,18 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; -import org.elasticsearch.xpack.ml.MachineLearning; import org.elasticsearch.xpack.core.ml.action.DeleteModelSnapshotAction; import org.elasticsearch.xpack.core.ml.job.config.Job; import org.elasticsearch.xpack.core.ml.job.process.autodetect.state.ModelSnapshotField; +import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.DELETE; @@ -26,13 +29,21 @@ public class RestDeleteModelSnapshotAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestDeleteModelSnapshotAction.class)); - public RestDeleteModelSnapshotAction(RestController controller) { + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - DELETE, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + - "}/model_snapshots/{" + ModelSnapshotField.SNAPSHOT_ID.getPreferredName() + "}", this, - DELETE, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + - "}/model_snapshots/{" + ModelSnapshotField.SNAPSHOT_ID.getPreferredName() + "}", deprecationLogger); + return Collections.singletonList( + new ReplacedRestApi(DELETE, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + + "}/model_snapshots/{" + ModelSnapshotField.SNAPSHOT_ID.getPreferredName() + "}", + DELETE, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + + "}/model_snapshots/{" + ModelSnapshotField.SNAPSHOT_ID.getPreferredName() + "}", + deprecationLogger) + ); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestGetModelSnapshotsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestGetModelSnapshotsAction.java index 2b2ef21442fa6..7ef294a2411df 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestGetModelSnapshotsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestGetModelSnapshotsAction.java @@ -10,8 +10,8 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.action.util.PageParams; import org.elasticsearch.xpack.core.ml.action.GetModelSnapshotsAction; @@ -20,6 +20,10 @@ import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -39,31 +43,36 @@ public class RestGetModelSnapshotsAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestGetModelSnapshotsAction.class)); - public RestGetModelSnapshotsAction(RestController controller) { - // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" - + Job.ID.getPreferredName() + "}/model_snapshots/{" + Request.SNAPSHOT_ID.getPreferredName() + "}", this, - GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" - + Job.ID.getPreferredName() + "}/model_snapshots/{" + Request.SNAPSHOT_ID.getPreferredName() + "}", deprecationLogger); - // endpoints that support body parameters must also accept POST - controller.registerWithDeprecatedHandler( - POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" - + Job.ID.getPreferredName() + "}/model_snapshots/{" + Request.SNAPSHOT_ID.getPreferredName() + "}", this, - POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" - + Job.ID.getPreferredName() + "}/model_snapshots/{" + Request.SNAPSHOT_ID.getPreferredName() + "}", deprecationLogger); + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } - controller.registerWithDeprecatedHandler( - GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" - + Job.ID.getPreferredName() + "}/model_snapshots", this, - GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" - + Job.ID.getPreferredName() + "}/model_snapshots", deprecationLogger); - // endpoints that support body parameters must also accept POST - controller.registerWithDeprecatedHandler( - POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" - + Job.ID.getPreferredName() + "}/model_snapshots", this, - POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" - + Job.ID.getPreferredName() + "}/model_snapshots", deprecationLogger); + @Override + public List replacedMethodsAndPaths() { + // TODO: remove deprecated endpoint in 8.0.0 + return Collections.unmodifiableList(Arrays.asList( + new ReplacedRestApi(GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + + Job.ID.getPreferredName() + "}/model_snapshots/{" + Request.SNAPSHOT_ID.getPreferredName() + "}", + GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + + Job.ID.getPreferredName() + "}/model_snapshots/{" + Request.SNAPSHOT_ID.getPreferredName() + "}", + deprecationLogger), + new ReplacedRestApi(POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + + Job.ID.getPreferredName() + "}/model_snapshots/{" + Request.SNAPSHOT_ID.getPreferredName() + "}", + POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + + Job.ID.getPreferredName() + "}/model_snapshots/{" + Request.SNAPSHOT_ID.getPreferredName() + "}", + deprecationLogger), + new ReplacedRestApi(GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + + Job.ID.getPreferredName() + "}/model_snapshots", + GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + + Job.ID.getPreferredName() + "}/model_snapshots", + deprecationLogger), + new ReplacedRestApi(POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + + Job.ID.getPreferredName() + "}/model_snapshots", + POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + + Job.ID.getPreferredName() + "}/model_snapshots", + deprecationLogger) + )); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestRevertModelSnapshotAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestRevertModelSnapshotAction.java index 33b31af99526b..4f4f03380b623 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestRevertModelSnapshotAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestRevertModelSnapshotAction.java @@ -10,14 +10,17 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestStatusToXContentListener; import org.elasticsearch.xpack.core.ml.action.RevertModelSnapshotAction; import org.elasticsearch.xpack.core.ml.job.config.Job; import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -28,13 +31,21 @@ public class RestRevertModelSnapshotAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestRevertModelSnapshotAction.class)); - public RestRevertModelSnapshotAction(RestController controller) { + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/model_snapshots/{" + - RevertModelSnapshotAction.Request.SNAPSHOT_ID.getPreferredName() + "}/_revert", this, - POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/model_snapshots/{" + - RevertModelSnapshotAction.Request.SNAPSHOT_ID.getPreferredName() + "}/_revert", deprecationLogger); + return Collections.singletonList( + new ReplacedRestApi(POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/model_snapshots/{" + + RevertModelSnapshotAction.Request.SNAPSHOT_ID.getPreferredName() + "}/_revert", + POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/model_snapshots/{" + + RevertModelSnapshotAction.Request.SNAPSHOT_ID.getPreferredName() + "}/_revert", + deprecationLogger) + ); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestUpdateModelSnapshotAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestUpdateModelSnapshotAction.java index e1cd0b2d2f5f7..5c336cd57dfe2 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestUpdateModelSnapshotAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestUpdateModelSnapshotAction.java @@ -10,8 +10,8 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestStatusToXContentListener; import org.elasticsearch.xpack.core.ml.action.UpdateModelSnapshotAction; import org.elasticsearch.xpack.core.ml.job.config.Job; @@ -19,6 +19,9 @@ import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -27,13 +30,21 @@ public class RestUpdateModelSnapshotAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestUpdateModelSnapshotAction.class)); - public RestUpdateModelSnapshotAction(RestController controller) { + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" - + Job.ID.getPreferredName() + "}/model_snapshots/{" + ModelSnapshotField.SNAPSHOT_ID +"}/_update", this, - POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" - + Job.ID.getPreferredName() + "}/model_snapshots/{" + ModelSnapshotField.SNAPSHOT_ID +"}/_update", deprecationLogger); + return Collections.singletonList( + new ReplacedRestApi(POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + + Job.ID.getPreferredName() + "}/model_snapshots/{" + ModelSnapshotField.SNAPSHOT_ID +"}/_update", + POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + + Job.ID.getPreferredName() + "}/model_snapshots/{" + ModelSnapshotField.SNAPSHOT_ID +"}/_update", + deprecationLogger) + ); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetBucketsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetBucketsAction.java index 8bb423199fe57..c767be6f03cc3 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetBucketsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetBucketsAction.java @@ -11,8 +11,8 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.action.util.PageParams; import org.elasticsearch.xpack.core.ml.action.GetBucketsAction; @@ -21,6 +21,10 @@ import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -30,29 +34,36 @@ public class RestGetBucketsAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestGetBucketsAction.class)); - public RestGetBucketsAction(RestController controller) { - // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() - + "}/results/buckets/{" + Result.TIMESTAMP.getPreferredName() + "}", this, - GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() - + "}/results/buckets/{" + Result.TIMESTAMP.getPreferredName() + "}", deprecationLogger); - controller.registerWithDeprecatedHandler( - POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() - + "}/results/buckets/{" + Result.TIMESTAMP.getPreferredName() + "}", this, - POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() - + "}/results/buckets/{" + Result.TIMESTAMP.getPreferredName() + "}", deprecationLogger); + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } - controller.registerWithDeprecatedHandler( - GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() - + "}/results/buckets", this, - GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() - + "}/results/buckets", deprecationLogger); - controller.registerWithDeprecatedHandler( - POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() - + "}/results/buckets", this, - POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() - + "}/results/buckets", deprecationLogger); + @Override + public List replacedMethodsAndPaths() { + // TODO: remove deprecated endpoint in 8.0.0 + return Collections.unmodifiableList(Arrays.asList( + new ReplacedRestApi(GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + + "}/results/buckets/{" + Result.TIMESTAMP.getPreferredName() + "}", + GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + + "}/results/buckets/{" + Result.TIMESTAMP.getPreferredName() + "}", + deprecationLogger), + new ReplacedRestApi(POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + + "}/results/buckets/{" + Result.TIMESTAMP.getPreferredName() + "}", + POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + + "}/results/buckets/{" + Result.TIMESTAMP.getPreferredName() + "}", + deprecationLogger), + new ReplacedRestApi(GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + + "}/results/buckets", + GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + + "}/results/buckets", + deprecationLogger), + new ReplacedRestApi(POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + + "}/results/buckets", + POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + + "}/results/buckets", + deprecationLogger) + )); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetCategoriesAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetCategoriesAction.java index e2e069efd76fd..7e459e6a337c6 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetCategoriesAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetCategoriesAction.java @@ -10,8 +10,8 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.action.util.PageParams; import org.elasticsearch.xpack.core.ml.action.GetCategoriesAction; @@ -20,6 +20,10 @@ import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -29,29 +33,32 @@ public class RestGetCategoriesAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestGetCategoriesAction.class)); - public RestGetCategoriesAction(RestController controller) { - // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/categories/{" - + Request.CATEGORY_ID.getPreferredName() + "}", this, - GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/categories/{" - + Request.CATEGORY_ID.getPreferredName() + "}", deprecationLogger); - controller.registerWithDeprecatedHandler( - GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/categories", - this, - GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/categories", - deprecationLogger); + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } - controller.registerWithDeprecatedHandler( - POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/categories/{" - + Request.CATEGORY_ID.getPreferredName() + "}", this, - POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/categories/{" - + Request.CATEGORY_ID.getPreferredName() + "}", deprecationLogger); - controller.registerWithDeprecatedHandler( - POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/categories", - this, - POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/categories", - deprecationLogger); + @Override + public List replacedMethodsAndPaths() { + // TODO: remove deprecated endpoint in 8.0.0 + return Collections.unmodifiableList(Arrays.asList( + new ReplacedRestApi(GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/categories/{" + + Request.CATEGORY_ID.getPreferredName() + "}", + GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/categories/{" + + Request.CATEGORY_ID.getPreferredName() + "}", + deprecationLogger), + new ReplacedRestApi(POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + + "}/results/categories/{" + Request.CATEGORY_ID.getPreferredName() + "}", + POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + + "}/results/categories/{" + Request.CATEGORY_ID.getPreferredName() + "}", + deprecationLogger), + new ReplacedRestApi(GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/categories", + GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/categories", + deprecationLogger), + new ReplacedRestApi(POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/categories", + POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/categories", + deprecationLogger) + )); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetInfluencersAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetInfluencersAction.java index a1ac9671b3bed..3c65ec9753640 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetInfluencersAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetInfluencersAction.java @@ -10,8 +10,8 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.action.util.PageParams; import org.elasticsearch.xpack.core.ml.action.GetInfluencersAction; @@ -19,6 +19,10 @@ import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -28,19 +32,24 @@ public class RestGetInfluencersAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestGetInfluencersAction.class)); - public RestGetInfluencersAction(RestController controller) { + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/influencers", - this, - GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/influencers", - deprecationLogger); - // endpoints that support body parameters must also accept POST - controller.registerWithDeprecatedHandler( - POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/influencers", - this, - POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/influencers", - deprecationLogger); + return Collections.unmodifiableList(Arrays.asList( + new ReplacedRestApi( + GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/influencers", + GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/influencers", + deprecationLogger), + new ReplacedRestApi( + POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/influencers", + POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/influencers", + deprecationLogger) + )); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetOverallBucketsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetOverallBucketsAction.java index 0b7763a8bf61d..b083a16777df1 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetOverallBucketsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetOverallBucketsAction.java @@ -10,8 +10,8 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.GetOverallBucketsAction; import org.elasticsearch.xpack.core.ml.action.GetOverallBucketsAction.Request; @@ -19,6 +19,10 @@ import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -28,18 +32,24 @@ public class RestGetOverallBucketsAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestGetOverallBucketsAction.class)); - public RestGetOverallBucketsAction(RestController controller) { + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/overall_buckets", - this, - GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/overall_buckets", - deprecationLogger); - controller.registerWithDeprecatedHandler( - POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/overall_buckets", - this, - POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/overall_buckets", - deprecationLogger); + return Collections.unmodifiableList(Arrays.asList( + new ReplacedRestApi( + GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/overall_buckets", + GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/overall_buckets", + deprecationLogger), + new ReplacedRestApi( + POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/overall_buckets", + POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/overall_buckets", + deprecationLogger) + )); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetRecordsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetRecordsAction.java index 0ce2b5e709917..757faff89af71 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetRecordsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetRecordsAction.java @@ -10,15 +10,19 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; -import org.elasticsearch.xpack.core.ml.action.GetRecordsAction; import org.elasticsearch.xpack.core.action.util.PageParams; +import org.elasticsearch.xpack.core.ml.action.GetRecordsAction; import org.elasticsearch.xpack.core.ml.job.config.Job; import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -28,18 +32,24 @@ public class RestGetRecordsAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestGetRecordsAction.class)); - public RestGetRecordsAction(RestController controller) { + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/records", - this, - GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/records", - deprecationLogger); - controller.registerWithDeprecatedHandler( - POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/records", - this, - POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/records", - deprecationLogger); + return Collections.unmodifiableList(Arrays.asList( + new ReplacedRestApi( + GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/records", + GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/records", + deprecationLogger), + new ReplacedRestApi( + POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/records", + POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/records", + deprecationLogger) + )); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/validate/RestValidateDetectorAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/validate/RestValidateDetectorAction.java index 3cf5f89f91991..fe852de54bdf8 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/validate/RestValidateDetectorAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/validate/RestValidateDetectorAction.java @@ -10,13 +10,16 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.ValidateDetectorAction; import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -25,11 +28,18 @@ public class RestValidateDetectorAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestValidateDetectorAction.class)); - public RestValidateDetectorAction(RestController controller) { + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - POST, MachineLearning.BASE_PATH + "anomaly_detectors/_validate/detector", this, - POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/_validate/detector", deprecationLogger); + return Collections.singletonList( + new ReplacedRestApi(POST, MachineLearning.BASE_PATH + "anomaly_detectors/_validate/detector", + POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/_validate/detector", deprecationLogger) + ); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/validate/RestValidateJobConfigAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/validate/RestValidateJobConfigAction.java index 9f16162d17264..23936c5d7a056 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/validate/RestValidateJobConfigAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/validate/RestValidateJobConfigAction.java @@ -10,13 +10,16 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.ValidateJobConfigAction; import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -25,11 +28,18 @@ public class RestValidateJobConfigAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestValidateJobConfigAction.class)); - public RestValidateJobConfigAction(RestController controller) { + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - POST, MachineLearning.BASE_PATH + "anomaly_detectors/_validate", this, - POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/_validate", deprecationLogger); + return Collections.singletonList( + new ReplacedRestApi(POST, MachineLearning.BASE_PATH + "anomaly_detectors/_validate", + POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/_validate", deprecationLogger) + ); } @Override diff --git a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestStartDatafeedActionTests.java b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestStartDatafeedActionTests.java index e36b8a6aaa33c..533da79aeb6fc 100644 --- a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestStartDatafeedActionTests.java +++ b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestStartDatafeedActionTests.java @@ -8,7 +8,6 @@ import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.xcontent.NamedXContentRegistry; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.rest.FakeRestRequest; @@ -21,8 +20,7 @@ public class RestStartDatafeedActionTests extends ESTestCase { public void testPrepareRequest() throws Exception { - RestStartDatafeedAction action = new RestStartDatafeedAction( - mock(RestController.class)); + RestStartDatafeedAction action = new RestStartDatafeedAction(); Map params = new HashMap<>(); params.put("start", "not-a-date"); diff --git a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/Monitoring.java b/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/Monitoring.java index c0981d17f177c..309b8b25cdd35 100644 --- a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/Monitoring.java +++ b/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/Monitoring.java @@ -151,7 +151,7 @@ public List getRestHandlers(Settings settings, RestController restC if (false == enabled) { return emptyList(); } - return singletonList(new RestMonitoringBulkAction(restController)); + return singletonList(new RestMonitoringBulkAction()); } @Override diff --git a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/rest/action/RestMonitoringBulkAction.java b/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/rest/action/RestMonitoringBulkAction.java index f72871fb055c1..f9694a84596e3 100644 --- a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/rest/action/RestMonitoringBulkAction.java +++ b/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/rest/action/RestMonitoringBulkAction.java @@ -12,8 +12,8 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestChannel; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestBuilderListener; import org.elasticsearch.xpack.core.monitoring.MonitoredSystem; @@ -22,11 +22,13 @@ import org.elasticsearch.xpack.core.monitoring.exporter.MonitoringTemplateUtils; import java.io.IOException; -import java.util.Arrays; import java.util.List; import java.util.Map; +import static java.util.Arrays.asList; import static java.util.Collections.emptyList; +import static java.util.Collections.singletonMap; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.common.unit.TimeValue.parseTimeValue; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.RestRequest.Method.PUT; @@ -36,21 +38,20 @@ public class RestMonitoringBulkAction extends BaseRestHandler { public static final String MONITORING_ID = "system_id"; public static final String MONITORING_VERSION = "system_api_version"; public static final String INTERVAL = "interval"; - private final Map> supportedApiVersions; - public RestMonitoringBulkAction(RestController controller) { - controller.registerHandler(POST, "/_monitoring/bulk", this); - controller.registerHandler(PUT, "/_monitoring/bulk", this); + private static final List ALL_VERSIONS = asList( + MonitoringTemplateUtils.TEMPLATE_VERSION, + MonitoringTemplateUtils.OLD_TEMPLATE_VERSION + ); - final List allVersions = Arrays.asList( - MonitoringTemplateUtils.TEMPLATE_VERSION, - MonitoringTemplateUtils.OLD_TEMPLATE_VERSION - ); + private static final Map> SUPPORTED_API_VERSIONS = Map.of( + MonitoredSystem.KIBANA, ALL_VERSIONS, + MonitoredSystem.LOGSTASH, ALL_VERSIONS, + MonitoredSystem.BEATS, ALL_VERSIONS); - supportedApiVersions = Map.of( - MonitoredSystem.KIBANA, allVersions, - MonitoredSystem.LOGSTASH, allVersions, - MonitoredSystem.BEATS, allVersions); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_monitoring/bulk", unmodifiableList(asList(POST, PUT))); } @Override @@ -108,7 +109,7 @@ public boolean supportsContentStream() { * @return true if supported, false otherwise */ private boolean isSupportedSystemVersion(final MonitoredSystem system, final String version) { - final List monitoredSystem = supportedApiVersions.getOrDefault(system, emptyList()); + final List monitoredSystem = SUPPORTED_API_VERSIONS.getOrDefault(system, emptyList()); return monitoredSystem.contains(version); } diff --git a/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/rest/action/RestMonitoringBulkActionTests.java b/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/rest/action/RestMonitoringBulkActionTests.java index 4f83898e48a66..8abbaad59748e 100644 --- a/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/rest/action/RestMonitoringBulkActionTests.java +++ b/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/rest/action/RestMonitoringBulkActionTests.java @@ -16,7 +16,6 @@ import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.common.xcontent.json.JsonXContent; import org.elasticsearch.rest.RestChannel; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; @@ -38,9 +37,7 @@ public class RestMonitoringBulkActionTests extends ESTestCase { - private final RestController controller = mock(RestController.class); - - private final RestMonitoringBulkAction action = new RestMonitoringBulkAction(controller); + private final RestMonitoringBulkAction action = new RestMonitoringBulkAction(); public void testGetName() { // Are you sure that you want to change the name? diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/Rollup.java b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/Rollup.java index f5ed5b86e7fc2..4ffe0ea3e417a 100644 --- a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/Rollup.java +++ b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/Rollup.java @@ -119,14 +119,14 @@ public List getRestHandlers(Settings settings, RestController restC } return Arrays.asList( - new RestRollupSearchAction(restController), - new RestPutRollupJobAction(restController), - new RestStartRollupJobAction(restController), - new RestStopRollupJobAction(restController), - new RestDeleteRollupJobAction(restController), - new RestGetRollupJobsAction(restController), - new RestGetRollupCapsAction(restController), - new RestGetRollupIndexCapsAction(restController) + new RestRollupSearchAction(), + new RestPutRollupJobAction(), + new RestStartRollupJobAction(), + new RestStopRollupJobAction(), + new RestDeleteRollupJobAction(), + new RestGetRollupJobsAction(), + new RestGetRollupCapsAction(), + new RestGetRollupIndexCapsAction() ); } diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestDeleteRollupJobAction.java b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestDeleteRollupJobAction.java index 83e1b53cb1a4b..c74b7c633f471 100644 --- a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestDeleteRollupJobAction.java +++ b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestDeleteRollupJobAction.java @@ -9,20 +9,26 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.ParseField; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.rollup.action.DeleteRollupJobAction; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.DELETE; public class RestDeleteRollupJobAction extends BaseRestHandler { public static final ParseField ID = new ParseField("id"); - public RestDeleteRollupJobAction(RestController controller) { - controller.registerHandler(DELETE, "/_rollup/job/{id}", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_rollup/job/{id}", singletonList(DELETE)); } @Override diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupCapsAction.java b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupCapsAction.java index 2c30efb5d833e..d31ef355eb120 100644 --- a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupCapsAction.java +++ b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupCapsAction.java @@ -9,19 +9,25 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.ParseField; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.rollup.action.GetRollupCapsAction; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestGetRollupCapsAction extends BaseRestHandler { public static final ParseField ID = new ParseField("id"); - public RestGetRollupCapsAction(RestController controller) { - controller.registerHandler(GET, "/_rollup/data/{id}", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_rollup/data/{id}", singletonList(GET)); } @Override diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupIndexCapsAction.java b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupIndexCapsAction.java index a4675bfa7f2e4..f545b0b91ec50 100644 --- a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupIndexCapsAction.java +++ b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupIndexCapsAction.java @@ -11,19 +11,25 @@ import org.elasticsearch.common.ParseField; import org.elasticsearch.common.Strings; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.rollup.action.GetRollupIndexCapsAction; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestGetRollupIndexCapsAction extends BaseRestHandler { static final ParseField INDEX = new ParseField("index"); - public RestGetRollupIndexCapsAction(RestController controller) { - controller.registerHandler(GET, "/{index}/_rollup/data", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/{index}/_rollup/data", singletonList(GET)); } @Override diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupJobsAction.java b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupJobsAction.java index cefa90266ea6b..9dbf2bb7a417f 100644 --- a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupJobsAction.java +++ b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupJobsAction.java @@ -9,19 +9,25 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.ParseField; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.rollup.action.GetRollupJobsAction; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestGetRollupJobsAction extends BaseRestHandler { public static final ParseField ID = new ParseField("id"); - public RestGetRollupJobsAction(RestController controller) { - controller.registerHandler(GET, "/_rollup/job/{id}", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_rollup/job/{id}", singletonList(GET)); } @Override diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestPutRollupJobAction.java b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestPutRollupJobAction.java index 4f1f2a1a4d5dd..9b7e2005de553 100644 --- a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestPutRollupJobAction.java +++ b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestPutRollupJobAction.java @@ -8,19 +8,24 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.rollup.action.PutRollupJobAction; import java.io.IOException; +import java.util.List; +import java.util.Map; +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.PUT; public class RestPutRollupJobAction extends BaseRestHandler { - public RestPutRollupJobAction(RestController controller) { - controller.registerHandler(PUT, "/_rollup/job/{id}", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_rollup/job/{id}", singletonList(PUT)); } @Override diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestRollupSearchAction.java b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestRollupSearchAction.java index 6a6aefd9c296c..90269511c1870 100644 --- a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestRollupSearchAction.java +++ b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestRollupSearchAction.java @@ -7,25 +7,35 @@ import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.rest.action.search.RestSearchAction; import org.elasticsearch.xpack.core.rollup.action.RollupSearchAction; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; import java.util.Set; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; +import static org.elasticsearch.rest.RestRequest.Method.GET; +import static org.elasticsearch.rest.RestRequest.Method.POST; + public class RestRollupSearchAction extends BaseRestHandler { private static final Set RESPONSE_PARAMS = Set.of(RestSearchAction.TYPED_KEYS_PARAM, RestSearchAction.TOTAL_HITS_AS_INT_PARAM); - public RestRollupSearchAction(RestController controller) { - controller.registerHandler(RestRequest.Method.GET, "_rollup_search", this); - controller.registerHandler(RestRequest.Method.POST, "_rollup_search", this); - controller.registerHandler(RestRequest.Method.GET, "{index}/_rollup_search", this); - controller.registerHandler(RestRequest.Method.POST, "{index}/_rollup_search", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("_rollup_search", unmodifiableList(asList(GET, POST))) + .put("{index}/_rollup_search", unmodifiableList(asList(GET, POST))) + .map()); } @Override diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestStartRollupJobAction.java b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestStartRollupJobAction.java index 8f11802addadf..cab8c893bc5a7 100644 --- a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestStartRollupJobAction.java +++ b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestStartRollupJobAction.java @@ -8,18 +8,24 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.rollup.RollupField; import org.elasticsearch.xpack.core.rollup.action.StartRollupJobAction; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestStartRollupJobAction extends BaseRestHandler { - public RestStartRollupJobAction(RestController controller) { - controller.registerHandler(POST, "/_rollup/job/{id}/_start", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_rollup/job/{id}/_start", singletonList(POST)); } @Override diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestStopRollupJobAction.java b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestStopRollupJobAction.java index 0d41893f9d6d2..2b4edffae875e 100644 --- a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestStopRollupJobAction.java +++ b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestStopRollupJobAction.java @@ -9,18 +9,24 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.rollup.RollupField; import org.elasticsearch.xpack.core.rollup.action.StopRollupJobAction; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestStopRollupJobAction extends BaseRestHandler { - public RestStopRollupJobAction(RestController controller) { - controller.registerHandler(POST, "/_rollup/job/{id}/_stop", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_rollup/job/{id}/_stop", singletonList(POST)); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/Security.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/Security.java index 27689e8688510..51d8347b78222 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/Security.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/Security.java @@ -767,40 +767,40 @@ public List getRestHandlers(Settings settings, RestController restC return emptyList(); } return Arrays.asList( - new RestAuthenticateAction(settings, restController, securityContext.get(), getLicenseState()), - new RestClearRealmCacheAction(settings, restController, getLicenseState()), - new RestClearRolesCacheAction(settings, restController, getLicenseState()), - new RestGetUsersAction(settings, restController, getLicenseState()), - new RestPutUserAction(settings, restController, getLicenseState()), - new RestDeleteUserAction(settings, restController, getLicenseState()), - new RestGetRolesAction(settings, restController, getLicenseState()), - new RestPutRoleAction(settings, restController, getLicenseState()), - new RestDeleteRoleAction(settings, restController, getLicenseState()), - new RestChangePasswordAction(settings, restController, securityContext.get(), getLicenseState()), - new RestSetEnabledAction(settings, restController, getLicenseState()), - new RestHasPrivilegesAction(settings, restController, securityContext.get(), getLicenseState()), - new RestGetUserPrivilegesAction(settings, restController, securityContext.get(), getLicenseState()), - new RestGetRoleMappingsAction(settings, restController, getLicenseState()), - new RestPutRoleMappingAction(settings, restController, getLicenseState()), - new RestDeleteRoleMappingAction(settings, restController, getLicenseState()), - new RestGetTokenAction(settings, restController, getLicenseState()), - new RestInvalidateTokenAction(settings, restController, getLicenseState()), - new RestGetCertificateInfoAction(restController), - new RestSamlPrepareAuthenticationAction(settings, restController, getLicenseState()), - new RestSamlAuthenticateAction(settings, restController, getLicenseState()), - new RestSamlLogoutAction(settings, restController, getLicenseState()), - new RestSamlInvalidateSessionAction(settings, restController, getLicenseState()), - new RestOpenIdConnectPrepareAuthenticationAction(settings, restController, getLicenseState()), - new RestOpenIdConnectAuthenticateAction(settings, restController, getLicenseState()), - new RestOpenIdConnectLogoutAction(settings, restController, getLicenseState()), - new RestGetBuiltinPrivilegesAction(settings, restController, getLicenseState()), - new RestGetPrivilegesAction(settings, restController, getLicenseState()), - new RestPutPrivilegesAction(settings, restController, getLicenseState()), - new RestDeletePrivilegesAction(settings, restController, getLicenseState()), - new RestCreateApiKeyAction(settings, restController, getLicenseState()), - new RestInvalidateApiKeyAction(settings, restController, getLicenseState()), - new RestGetApiKeyAction(settings, restController, getLicenseState()), - new RestDelegatePkiAuthenticationAction(settings, restController, getLicenseState()) + new RestAuthenticateAction(settings, securityContext.get(), getLicenseState()), + new RestClearRealmCacheAction(settings, getLicenseState()), + new RestClearRolesCacheAction(settings, getLicenseState()), + new RestGetUsersAction(settings, getLicenseState()), + new RestPutUserAction(settings, getLicenseState()), + new RestDeleteUserAction(settings, getLicenseState()), + new RestGetRolesAction(settings, getLicenseState()), + new RestPutRoleAction(settings, getLicenseState()), + new RestDeleteRoleAction(settings, getLicenseState()), + new RestChangePasswordAction(settings, securityContext.get(), getLicenseState()), + new RestSetEnabledAction(settings, getLicenseState()), + new RestHasPrivilegesAction(settings, securityContext.get(), getLicenseState()), + new RestGetUserPrivilegesAction(settings, securityContext.get(), getLicenseState()), + new RestGetRoleMappingsAction(settings, getLicenseState()), + new RestPutRoleMappingAction(settings, getLicenseState()), + new RestDeleteRoleMappingAction(settings, getLicenseState()), + new RestGetTokenAction(settings, getLicenseState()), + new RestInvalidateTokenAction(settings, getLicenseState()), + new RestGetCertificateInfoAction(), + new RestSamlPrepareAuthenticationAction(settings, getLicenseState()), + new RestSamlAuthenticateAction(settings, getLicenseState()), + new RestSamlLogoutAction(settings, getLicenseState()), + new RestSamlInvalidateSessionAction(settings, getLicenseState()), + new RestOpenIdConnectPrepareAuthenticationAction(settings, getLicenseState()), + new RestOpenIdConnectAuthenticateAction(settings, getLicenseState()), + new RestOpenIdConnectLogoutAction(settings, getLicenseState()), + new RestGetBuiltinPrivilegesAction(settings, getLicenseState()), + new RestGetPrivilegesAction(settings, getLicenseState()), + new RestPutPrivilegesAction(settings, getLicenseState()), + new RestDeletePrivilegesAction(settings, getLicenseState()), + new RestCreateApiKeyAction(settings, getLicenseState()), + new RestInvalidateApiKeyAction(settings, getLicenseState()), + new RestGetApiKeyAction(settings, getLicenseState()), + new RestDelegatePkiAuthenticationAction(settings, getLicenseState()) ); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/SecurityRestFilter.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/SecurityRestFilter.java index 4131d1e735883..22d4808860567 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/SecurityRestFilter.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/SecurityRestFilter.java @@ -24,6 +24,8 @@ import org.elasticsearch.xpack.security.transport.SSLEngineUtils; import java.io.IOException; +import java.util.List; +import java.util.Map; public class SecurityRestFilter implements RestHandler { @@ -91,6 +93,21 @@ public boolean allowsUnsafeBuffers() { return restHandler.allowsUnsafeBuffers(); } + @Override + public Map> handledMethodsAndPaths() { + return restHandler.handledMethodsAndPaths(); + } + + @Override + public List deprecatedHandledMethodsAndPaths() { + return restHandler.deprecatedHandledMethodsAndPaths(); + } + + @Override + public List replacedMethodsAndPaths() { + return restHandler.replacedMethodsAndPaths(); + } + private RestRequest maybeWrapRestRequest(RestRequest restRequest) throws IOException { if (restHandler instanceof RestRequestFilter) { return ((RestRequestFilter)restHandler).getFilteredRequest(restRequest); diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/RestAuthenticateAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/RestAuthenticateAction.java index 09f0679378c54..60deb9ef4b1a1 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/RestAuthenticateAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/RestAuthenticateAction.java @@ -13,8 +13,8 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -25,6 +25,9 @@ import org.elasticsearch.xpack.core.security.user.User; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.GET; @@ -33,14 +36,21 @@ public class RestAuthenticateAction extends SecurityBaseRestHandler { private final SecurityContext securityContext; private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestAuthenticateAction.class)); - public RestAuthenticateAction(Settings settings, RestController controller, SecurityContext securityContext, - XPackLicenseState licenseState) { + public RestAuthenticateAction(Settings settings, SecurityContext securityContext, XPackLicenseState licenseState) { super(settings, licenseState); this.securityContext = securityContext; + } + + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - GET, "/_security/_authenticate", this, - GET, "/_xpack/security/_authenticate", deprecationLogger); + return Collections.singletonList(new ReplacedRestApi(GET, "/_security/_authenticate", GET, + "/_xpack/security/_authenticate", deprecationLogger)); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/RestDelegatePkiAuthenticationAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/RestDelegatePkiAuthenticationAction.java index c63d965a3b7c6..9076fc46fe0f9 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/RestDelegatePkiAuthenticationAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/RestDelegatePkiAuthenticationAction.java @@ -10,25 +10,29 @@ import org.apache.logging.log4j.Logger; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.license.LicenseUtils; import org.elasticsearch.license.XPackLicenseState; -import org.elasticsearch.rest.RestController; -import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.BytesRestResponse; +import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; import org.elasticsearch.xpack.core.security.action.DelegatePkiAuthenticationAction; import org.elasticsearch.xpack.core.security.action.DelegatePkiAuthenticationRequest; -import org.elasticsearch.xpack.security.action.TransportDelegatePkiAuthenticationAction; -import org.elasticsearch.xpack.security.authc.Realms; import org.elasticsearch.xpack.core.security.action.DelegatePkiAuthenticationResponse; import org.elasticsearch.xpack.core.security.authc.pki.PkiRealmSettings; -import org.elasticsearch.common.xcontent.XContentBuilder; +import org.elasticsearch.xpack.security.action.TransportDelegatePkiAuthenticationAction; +import org.elasticsearch.xpack.security.authc.Realms; import java.io.IOException; +import java.util.List; +import java.util.Map; +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.POST; /** @@ -40,9 +44,13 @@ public final class RestDelegatePkiAuthenticationAction extends SecurityBaseRestH protected Logger logger = LogManager.getLogger(RestDelegatePkiAuthenticationAction.class); - public RestDelegatePkiAuthenticationAction(Settings settings, RestController controller, XPackLicenseState xPackLicenseState) { + public RestDelegatePkiAuthenticationAction(Settings settings, XPackLicenseState xPackLicenseState) { super(settings, xPackLicenseState); - controller.registerHandler(POST, "/_security/delegate_pki", this); + } + + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_security/delegate_pki", singletonList(POST)); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestCreateApiKeyAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestCreateApiKeyAction.java index b75de301e7e4a..4f1cedc347564 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestCreateApiKeyAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestCreateApiKeyAction.java @@ -10,13 +10,21 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.license.XPackLicenseState; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.security.action.CreateApiKeyRequest; import org.elasticsearch.xpack.core.security.action.CreateApiKeyRequestBuilder; import java.io.IOException; +import java.util.List; +import java.util.Map; + +import static java.util.Arrays.asList; +import static java.util.Collections.singletonMap; +import static java.util.Collections.unmodifiableList; +import static org.elasticsearch.rest.RestRequest.Method.POST; +import static org.elasticsearch.rest.RestRequest.Method.PUT; /** * Rest action to create an API key @@ -28,10 +36,13 @@ public final class RestCreateApiKeyAction extends ApiKeyBaseRestHandler { * @param licenseState the license state that will be used to determine if * security is licensed */ - public RestCreateApiKeyAction(Settings settings, RestController controller, XPackLicenseState licenseState) { + public RestCreateApiKeyAction(Settings settings, XPackLicenseState licenseState) { super(settings, licenseState); - controller.registerHandler(RestRequest.Method.POST, "/_security/api_key", this); - controller.registerHandler(RestRequest.Method.PUT, "/_security/api_key", this); + } + + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_security/api_key", unmodifiableList(asList(POST, PUT))); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestGetApiKeyAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestGetApiKeyAction.java index ca07952478444..ccef1616f7eff 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestGetApiKeyAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestGetApiKeyAction.java @@ -12,8 +12,8 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -22,15 +22,25 @@ import org.elasticsearch.xpack.core.security.action.GetApiKeyResponse; import java.io.IOException; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.GET; /** * Rest action to get one or more API keys information. */ public final class RestGetApiKeyAction extends ApiKeyBaseRestHandler { - public RestGetApiKeyAction(Settings settings, RestController controller, XPackLicenseState licenseState) { + public RestGetApiKeyAction(Settings settings, XPackLicenseState licenseState) { super(settings, licenseState); - controller.registerHandler(RestRequest.Method.GET, "/_security/api_key", this); + } + + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_security/api_key", singletonList(GET)); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestInvalidateApiKeyAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestInvalidateApiKeyAction.java index 0579932887677..457aa98efabc3 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestInvalidateApiKeyAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestInvalidateApiKeyAction.java @@ -14,8 +14,8 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -24,6 +24,12 @@ import org.elasticsearch.xpack.core.security.action.InvalidateApiKeyResponse; import java.io.IOException; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.DELETE; /** * Rest action to invalidate one or more API keys @@ -43,9 +49,13 @@ public final class RestInvalidateApiKeyAction extends ApiKeyBaseRestHandler { PARSER.declareBoolean(ConstructingObjectParser.optionalConstructorArg(), new ParseField("owner")); } - public RestInvalidateApiKeyAction(Settings settings, RestController controller, XPackLicenseState licenseState) { + public RestInvalidateApiKeyAction(Settings settings, XPackLicenseState licenseState) { super(settings, licenseState); - controller.registerHandler(RestRequest.Method.DELETE, "/_security/api_key", this); + } + + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_security/api_key", singletonList(DELETE)); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oauth2/RestGetTokenAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oauth2/RestGetTokenAction.java index c3734f37d1a54..ec07e007ac2da 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oauth2/RestGetTokenAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oauth2/RestGetTokenAction.java @@ -8,9 +8,9 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.elasticsearch.ElasticsearchSecurityException; -import org.elasticsearch.action.ActionType; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.ActionRequestValidationException; +import org.elasticsearch.action.ActionType; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.ParseField; import org.elasticsearch.common.logging.DeprecationLogger; @@ -23,8 +23,8 @@ import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestChannel; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.xpack.core.security.action.token.CreateTokenAction; import org.elasticsearch.xpack.core.security.action.token.CreateTokenRequest; @@ -34,8 +34,10 @@ import java.io.IOException; import java.util.Arrays; +import java.util.Collections; import java.util.List; import java.util.Locale; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -65,12 +67,21 @@ public final class RestGetTokenAction extends TokenBaseRestHandler { PARSER.declareString(ConstructingObjectParser.optionalConstructorArg(), new ParseField("refresh_token")); } - public RestGetTokenAction(Settings settings, RestController controller, XPackLicenseState xPackLicenseState) { + public RestGetTokenAction(Settings settings, XPackLicenseState xPackLicenseState) { super(settings, xPackLicenseState); + } + + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - POST, "/_security/oauth2/token", this, - POST, "/_xpack/security/oauth2/token", deprecationLogger); + return Collections.singletonList( + new ReplacedRestApi(POST, "/_security/oauth2/token", POST, "/_xpack/security/oauth2/token", deprecationLogger) + ); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oauth2/RestInvalidateTokenAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oauth2/RestInvalidateTokenAction.java index cb72e53bcc8d3..34a614f1f8885 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oauth2/RestInvalidateTokenAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oauth2/RestInvalidateTokenAction.java @@ -16,8 +16,8 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -26,6 +26,9 @@ import org.elasticsearch.xpack.core.security.action.token.InvalidateTokenResponse; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.DELETE; @@ -63,12 +66,21 @@ public final class RestInvalidateTokenAction extends TokenBaseRestHandler { PARSER.declareString(ConstructingObjectParser.optionalConstructorArg(), new ParseField("username")); } - public RestInvalidateTokenAction(Settings settings, RestController controller, XPackLicenseState xPackLicenseState) { + public RestInvalidateTokenAction(Settings settings, XPackLicenseState xPackLicenseState) { super(settings, xPackLicenseState); + } + + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - DELETE, "/_security/oauth2/token", this, - DELETE, "/_xpack/security/oauth2/token", deprecationLogger); + return Collections.singletonList( + new ReplacedRestApi(DELETE, "/_security/oauth2/token", DELETE, "/_xpack/security/oauth2/token", deprecationLogger) + ); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oidc/RestOpenIdConnectAuthenticateAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oidc/RestOpenIdConnectAuthenticateAction.java index d820fb7a88b47..34101df73bbb3 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oidc/RestOpenIdConnectAuthenticateAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oidc/RestOpenIdConnectAuthenticateAction.java @@ -15,8 +15,8 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -25,7 +25,11 @@ import org.elasticsearch.xpack.core.security.action.oidc.OpenIdConnectAuthenticateResponse; import java.io.IOException; +import java.util.List; +import java.util.Map; +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.POST; /** @@ -44,9 +48,13 @@ public class RestOpenIdConnectAuthenticateAction extends OpenIdConnectBaseRestHa PARSER.declareStringOrNull(OpenIdConnectAuthenticateRequest::setRealm, new ParseField("realm")); } - public RestOpenIdConnectAuthenticateAction(Settings settings, RestController controller, XPackLicenseState licenseState) { + public RestOpenIdConnectAuthenticateAction(Settings settings, XPackLicenseState licenseState) { super(settings, licenseState); - controller.registerHandler(POST, "/_security/oidc/authenticate", this); + } + + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_security/oidc/authenticate", singletonList(POST)); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oidc/RestOpenIdConnectLogoutAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oidc/RestOpenIdConnectLogoutAction.java index e098e14c423b8..b0b2a5b724698 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oidc/RestOpenIdConnectLogoutAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oidc/RestOpenIdConnectLogoutAction.java @@ -13,8 +13,8 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -23,7 +23,11 @@ import org.elasticsearch.xpack.core.security.action.oidc.OpenIdConnectLogoutResponse; import java.io.IOException; +import java.util.List; +import java.util.Map; +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.POST; /** @@ -40,9 +44,13 @@ public class RestOpenIdConnectLogoutAction extends OpenIdConnectBaseRestHandler PARSER.declareString(OpenIdConnectLogoutRequest::setRefreshToken, new ParseField("refresh_token")); } - public RestOpenIdConnectLogoutAction(Settings settings, RestController controller, XPackLicenseState licenseState) { + public RestOpenIdConnectLogoutAction(Settings settings, XPackLicenseState licenseState) { super(settings, licenseState); - controller.registerHandler(POST, "/_security/oidc/logout", this); + } + + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_security/oidc/logout", singletonList(POST)); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oidc/RestOpenIdConnectPrepareAuthenticationAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oidc/RestOpenIdConnectPrepareAuthenticationAction.java index c86da0ed4edc9..54694a482a86f 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oidc/RestOpenIdConnectPrepareAuthenticationAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oidc/RestOpenIdConnectPrepareAuthenticationAction.java @@ -15,8 +15,8 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -25,7 +25,11 @@ import org.elasticsearch.xpack.core.security.action.oidc.OpenIdConnectPrepareAuthenticationResponse; import java.io.IOException; +import java.util.List; +import java.util.Map; +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.POST; /** @@ -45,9 +49,13 @@ public class RestOpenIdConnectPrepareAuthenticationAction extends OpenIdConnectB PARSER.declareString(OpenIdConnectPrepareAuthenticationRequest::setNonce, new ParseField("nonce")); } - public RestOpenIdConnectPrepareAuthenticationAction(Settings settings, RestController controller, XPackLicenseState licenseState) { + public RestOpenIdConnectPrepareAuthenticationAction(Settings settings, XPackLicenseState licenseState) { super(settings, licenseState); - controller.registerHandler(POST, "/_security/oidc/prepare", this); + } + + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_security/oidc/prepare", singletonList(POST)); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestDeletePrivilegesAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestDeletePrivilegesAction.java index 41758aa26016f..c2682d765b7d0 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestDeletePrivilegesAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestDeletePrivilegesAction.java @@ -12,8 +12,8 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -25,6 +25,8 @@ import java.util.Arrays; import java.util.Collections; import java.util.HashSet; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.DELETE; @@ -36,12 +38,20 @@ public class RestDeletePrivilegesAction extends SecurityBaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestDeletePrivilegesAction.class)); - public RestDeletePrivilegesAction(Settings settings, RestController controller, XPackLicenseState licenseState) { + public RestDeletePrivilegesAction(Settings settings, XPackLicenseState licenseState) { super(settings, licenseState); + } + + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - DELETE, "/_security/privilege/{application}/{privilege}", this, - DELETE, "/_xpack/security/privilege/{application}/{privilege}", deprecationLogger); + return Collections.singletonList(new ReplacedRestApi(DELETE, "/_security/privilege/{application}/{privilege}", DELETE, + "/_xpack/security/privilege/{application}/{privilege}", deprecationLogger)); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestGetBuiltinPrivilegesAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestGetBuiltinPrivilegesAction.java index 15f4612d90429..72a394f9e1f90 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestGetBuiltinPrivilegesAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestGetBuiltinPrivilegesAction.java @@ -10,8 +10,8 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -21,7 +21,11 @@ import org.elasticsearch.xpack.security.rest.action.SecurityBaseRestHandler; import java.io.IOException; +import java.util.List; +import java.util.Map; +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; /** @@ -29,10 +33,13 @@ */ public class RestGetBuiltinPrivilegesAction extends SecurityBaseRestHandler { - public RestGetBuiltinPrivilegesAction(Settings settings, RestController controller, XPackLicenseState licenseState) { + public RestGetBuiltinPrivilegesAction(Settings settings, XPackLicenseState licenseState) { super(settings, licenseState); - controller.registerHandler( - GET, "/_security/privilege/_builtin", this); + } + + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_security/privilege/_builtin", singletonList(GET)); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestGetPrivilegesAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestGetPrivilegesAction.java index 7a5261c42bc93..d1afe23409db5 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestGetPrivilegesAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestGetPrivilegesAction.java @@ -14,8 +14,8 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -27,6 +27,7 @@ import java.io.IOException; import java.util.Arrays; import java.util.Collections; +import java.util.List; import java.util.Map; import java.util.Set; import java.util.stream.Collectors; @@ -40,18 +41,25 @@ public class RestGetPrivilegesAction extends SecurityBaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestGetPrivilegesAction.class)); - public RestGetPrivilegesAction(Settings settings, RestController controller, XPackLicenseState licenseState) { + public RestGetPrivilegesAction(Settings settings, XPackLicenseState licenseState) { super(settings, licenseState); + } + + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - GET, "/_security/privilege/", this, - GET, "/_xpack/security/privilege/", deprecationLogger); - controller.registerWithDeprecatedHandler( - GET, "/_security/privilege/{application}", this, - GET, "/_xpack/security/privilege/{application}", deprecationLogger); - controller.registerWithDeprecatedHandler( - GET, "/_security/privilege/{application}/{privilege}", this, - GET, "/_xpack/security/privilege/{application}/{privilege}", deprecationLogger); + return Collections.unmodifiableList(Arrays.asList( + new ReplacedRestApi(GET, "/_security/privilege/", GET, "/_xpack/security/privilege/", deprecationLogger), + new ReplacedRestApi(GET, "/_security/privilege/{application}", + GET, "/_xpack/security/privilege/{application}", deprecationLogger), + new ReplacedRestApi(GET, "/_security/privilege/{application}/{privilege}", + GET, "/_xpack/security/privilege/{application}/{privilege}", deprecationLogger) + )); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestPutPrivilegesAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestPutPrivilegesAction.java index 082751affb8b5..c578819739d39 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestPutPrivilegesAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestPutPrivilegesAction.java @@ -12,8 +12,8 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -24,6 +24,7 @@ import org.elasticsearch.xpack.security.rest.action.SecurityBaseRestHandler; import java.io.IOException; +import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -38,15 +39,22 @@ public class RestPutPrivilegesAction extends SecurityBaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestPutPrivilegesAction.class)); - public RestPutPrivilegesAction(Settings settings, RestController controller, XPackLicenseState licenseState) { + public RestPutPrivilegesAction(Settings settings, XPackLicenseState licenseState) { super(settings, licenseState); + } + + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - PUT, "/_security/privilege/", this, - PUT, "/_xpack/security/privilege/", deprecationLogger); - controller.registerWithDeprecatedHandler( - POST, "/_security/privilege/", this, - POST, "/_xpack/security/privilege/", deprecationLogger); + return Collections.unmodifiableList(Arrays.asList( + new ReplacedRestApi(PUT, "/_security/privilege/", PUT, "/_xpack/security/privilege/", deprecationLogger), + new ReplacedRestApi(POST, "/_security/privilege/", POST, "/_xpack/security/privilege/", deprecationLogger) + )); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/realm/RestClearRealmCacheAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/realm/RestClearRealmCacheAction.java index e1590c39fe90e..72bfd150a9757 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/realm/RestClearRealmCacheAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/realm/RestClearRealmCacheAction.java @@ -10,25 +10,39 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.license.XPackLicenseState; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestActions.NodesResponseRestListener; import org.elasticsearch.xpack.core.security.action.realm.ClearRealmCacheAction; import org.elasticsearch.xpack.core.security.action.realm.ClearRealmCacheRequest; import org.elasticsearch.xpack.security.rest.action.SecurityBaseRestHandler; +import java.util.Collections; +import java.util.List; +import java.util.Map; + import static org.elasticsearch.rest.RestRequest.Method.POST; public final class RestClearRealmCacheAction extends SecurityBaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestClearRealmCacheAction.class)); - public RestClearRealmCacheAction(Settings settings, RestController controller, XPackLicenseState licenseState) { + public RestClearRealmCacheAction(Settings settings, XPackLicenseState licenseState) { super(settings, licenseState); + } + + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - POST, "/_security/realm/{realms}/_clear_cache", this, - POST, "/_xpack/security/realm/{realms}/_clear_cache", deprecationLogger); + return Collections.singletonList( + new ReplacedRestApi(POST, "/_security/realm/{realms}/_clear_cache", + POST, "/_xpack/security/realm/{realms}/_clear_cache", deprecationLogger) + ); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestClearRolesCacheAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestClearRolesCacheAction.java index 0fd15051e8231..7be9b8dd498d9 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestClearRolesCacheAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestClearRolesCacheAction.java @@ -10,25 +10,37 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.license.XPackLicenseState; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestActions.NodesResponseRestListener; import org.elasticsearch.xpack.core.security.action.role.ClearRolesCacheAction; import org.elasticsearch.xpack.core.security.action.role.ClearRolesCacheRequest; import org.elasticsearch.xpack.security.rest.action.SecurityBaseRestHandler; +import java.util.Collections; +import java.util.List; +import java.util.Map; + import static org.elasticsearch.rest.RestRequest.Method.POST; public final class RestClearRolesCacheAction extends SecurityBaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestClearRolesCacheAction.class)); - public RestClearRolesCacheAction(Settings settings, RestController controller, XPackLicenseState licenseState) { + public RestClearRolesCacheAction(Settings settings, XPackLicenseState licenseState) { super(settings, licenseState); + } + + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - POST, "/_security/role/{name}/_clear_cache", this, - POST, "/_xpack/security/role/{name}/_clear_cache", deprecationLogger); + return Collections.singletonList(new ReplacedRestApi(POST, "/_security/role/{name}/_clear_cache", POST, + "/_xpack/security/role/{name}/_clear_cache", deprecationLogger)); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestDeleteRoleAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestDeleteRoleAction.java index 957cac123486c..775dd1c60a0b5 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestDeleteRoleAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestDeleteRoleAction.java @@ -12,8 +12,8 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -22,6 +22,9 @@ import org.elasticsearch.xpack.security.rest.action.SecurityBaseRestHandler; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.DELETE; @@ -32,12 +35,20 @@ public class RestDeleteRoleAction extends SecurityBaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestDeleteRoleAction.class)); - public RestDeleteRoleAction(Settings settings, RestController controller, XPackLicenseState licenseState) { + public RestDeleteRoleAction(Settings settings, XPackLicenseState licenseState) { super(settings, licenseState); + } + + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - DELETE, "/_security/role/{name}", this, - DELETE, "/_xpack/security/role/{name}", deprecationLogger); + return Collections.singletonList(new ReplacedRestApi(DELETE, "/_security/role/{name}", DELETE, + "/_xpack/security/role/{name}", deprecationLogger)); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestGetRolesAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestGetRolesAction.java index a5141f25f37a1..4ed1e2bc5f85f 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestGetRolesAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestGetRolesAction.java @@ -13,8 +13,8 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -24,6 +24,10 @@ import org.elasticsearch.xpack.security.rest.action.SecurityBaseRestHandler; import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.GET; @@ -34,15 +38,22 @@ public class RestGetRolesAction extends SecurityBaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestGetRolesAction.class)); - public RestGetRolesAction(Settings settings, RestController controller, XPackLicenseState licenseState) { + public RestGetRolesAction(Settings settings, XPackLicenseState licenseState) { super(settings, licenseState); + } + + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - GET, "/_security/role/", this, - GET, "/_xpack/security/role/", deprecationLogger); - controller.registerWithDeprecatedHandler( - GET, "/_security/role/{name}", this, - GET, "/_xpack/security/role/{name}", deprecationLogger); + return Collections.unmodifiableList(Arrays.asList( + new ReplacedRestApi(GET, "/_security/role/", GET, "/_xpack/security/role/", deprecationLogger), + new ReplacedRestApi(GET, "/_security/role/{name}", GET, "/_xpack/security/role/{name}", deprecationLogger) + )); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestPutRoleAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestPutRoleAction.java index e8b2e6a778386..ad9513d1dd050 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestPutRoleAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestPutRoleAction.java @@ -12,8 +12,8 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -22,6 +22,10 @@ import org.elasticsearch.xpack.security.rest.action.SecurityBaseRestHandler; import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.RestRequest.Method.PUT; @@ -33,15 +37,22 @@ public class RestPutRoleAction extends SecurityBaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestPutRoleAction.class)); - public RestPutRoleAction(Settings settings, RestController controller, XPackLicenseState licenseState) { + public RestPutRoleAction(Settings settings, XPackLicenseState licenseState) { super(settings, licenseState); + } + + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - POST, "/_security/role/{name}", this, - POST, "/_xpack/security/role/{name}", deprecationLogger); - controller.registerWithDeprecatedHandler( - PUT, "/_security/role/{name}", this, - PUT, "/_xpack/security/role/{name}", deprecationLogger); + return Collections.unmodifiableList(Arrays.asList( + new ReplacedRestApi(POST, "/_security/role/{name}", POST, "/_xpack/security/role/{name}", deprecationLogger), + new ReplacedRestApi(PUT, "/_security/role/{name}", PUT, "/_xpack/security/role/{name}", deprecationLogger) + )); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/rolemapping/RestDeleteRoleMappingAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/rolemapping/RestDeleteRoleMappingAction.java index a2383534115cc..43d9987268012 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/rolemapping/RestDeleteRoleMappingAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/rolemapping/RestDeleteRoleMappingAction.java @@ -12,8 +12,8 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -22,6 +22,9 @@ import org.elasticsearch.xpack.security.rest.action.SecurityBaseRestHandler; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.DELETE; @@ -33,12 +36,21 @@ public class RestDeleteRoleMappingAction extends SecurityBaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestDeleteRoleMappingAction.class)); - public RestDeleteRoleMappingAction(Settings settings, RestController controller, XPackLicenseState licenseState) { + public RestDeleteRoleMappingAction(Settings settings, XPackLicenseState licenseState) { super(settings, licenseState); + } + + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - DELETE, "/_security/role_mapping/{name}", this, - DELETE, "/_xpack/security/role_mapping/{name}", deprecationLogger); + return Collections.singletonList( + new ReplacedRestApi(DELETE, "/_security/role_mapping/{name}", DELETE, "/_xpack/security/role_mapping/{name}", deprecationLogger) + ); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/rolemapping/RestGetRoleMappingsAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/rolemapping/RestGetRoleMappingsAction.java index aeac89e8ffb9a..cefd6c960e474 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/rolemapping/RestGetRoleMappingsAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/rolemapping/RestGetRoleMappingsAction.java @@ -12,8 +12,8 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -23,6 +23,10 @@ import org.elasticsearch.xpack.security.rest.action.SecurityBaseRestHandler; import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.GET; @@ -33,15 +37,22 @@ public class RestGetRoleMappingsAction extends SecurityBaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestGetRoleMappingsAction.class)); - public RestGetRoleMappingsAction(Settings settings, RestController controller, XPackLicenseState licenseState) { + public RestGetRoleMappingsAction(Settings settings, XPackLicenseState licenseState) { super(settings, licenseState); + } + + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - GET, "/_security/role_mapping/", this, - GET, "/_xpack/security/role_mapping/", deprecationLogger); - controller.registerWithDeprecatedHandler( - GET, "/_security/role_mapping/{name}", this, - GET, "/_xpack/security/role_mapping/{name}", deprecationLogger); + return Collections.unmodifiableList(Arrays.asList( + new ReplacedRestApi(GET, "/_security/role_mapping/", GET, "/_xpack/security/role_mapping/", deprecationLogger), + new ReplacedRestApi(GET, "/_security/role_mapping/{name}", GET, "/_xpack/security/role_mapping/{name}", deprecationLogger) + )); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/rolemapping/RestPutRoleMappingAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/rolemapping/RestPutRoleMappingAction.java index 532a12644a7bd..df20c71c7ebe9 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/rolemapping/RestPutRoleMappingAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/rolemapping/RestPutRoleMappingAction.java @@ -12,8 +12,8 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -22,6 +22,10 @@ import org.elasticsearch.xpack.security.rest.action.SecurityBaseRestHandler; import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.RestRequest.Method.PUT; @@ -35,15 +39,22 @@ public class RestPutRoleMappingAction extends SecurityBaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestPutRoleMappingAction.class)); - public RestPutRoleMappingAction(Settings settings, RestController controller, XPackLicenseState licenseState) { + public RestPutRoleMappingAction(Settings settings, XPackLicenseState licenseState) { super(settings, licenseState); + } + + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - POST, "/_security/role_mapping/{name}", this, - POST, "/_xpack/security/role_mapping/{name}", deprecationLogger); - controller.registerWithDeprecatedHandler( - PUT, "/_security/role_mapping/{name}", this, - PUT, "/_xpack/security/role_mapping/{name}", deprecationLogger); + return Collections.unmodifiableList(Arrays.asList( + new ReplacedRestApi(POST, "/_security/role_mapping/{name}", POST, "/_xpack/security/role_mapping/{name}", deprecationLogger), + new ReplacedRestApi(PUT, "/_security/role_mapping/{name}", PUT, "/_xpack/security/role_mapping/{name}", deprecationLogger) + )); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/saml/RestSamlAuthenticateAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/saml/RestSamlAuthenticateAction.java index 486e749ca6a27..3111fa3070135 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/saml/RestSamlAuthenticateAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/saml/RestSamlAuthenticateAction.java @@ -17,9 +17,8 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; -import org.elasticsearch.rest.RestHandler; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -28,14 +27,16 @@ import java.io.IOException; import java.util.Base64; +import java.util.Collections; import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.POST; /** * A REST handler that attempts to authenticate a user based on the provided SAML response/assertion. */ -public class RestSamlAuthenticateAction extends SamlBaseRestHandler implements RestHandler { +public class RestSamlAuthenticateAction extends SamlBaseRestHandler { private static final Logger logger = LogManager.getLogger(); private static final DeprecationLogger deprecationLogger = new DeprecationLogger(logger); @@ -63,13 +64,22 @@ void setIds(List ids) { PARSER.declareStringOrNull(Input::setRealm, new ParseField("realm")); } - public RestSamlAuthenticateAction(Settings settings, RestController controller, - XPackLicenseState licenseState) { + public RestSamlAuthenticateAction(Settings settings, XPackLicenseState licenseState) { super(settings, licenseState); + } + + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - POST, "/_security/saml/authenticate", this, - POST, "/_xpack/security/saml/authenticate", deprecationLogger); + return Collections.singletonList( + new ReplacedRestApi(POST, "/_security/saml/authenticate", + POST, "/_xpack/security/saml/authenticate", deprecationLogger) + ); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/saml/RestSamlInvalidateSessionAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/saml/RestSamlInvalidateSessionAction.java index 4fe8e7ac5b256..7734e2f25e137 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/saml/RestSamlInvalidateSessionAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/saml/RestSamlInvalidateSessionAction.java @@ -5,8 +5,6 @@ */ package org.elasticsearch.xpack.security.rest.action.saml; -import java.io.IOException; - import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.ParseField; @@ -17,8 +15,8 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -26,6 +24,11 @@ import org.elasticsearch.xpack.core.security.action.saml.SamlInvalidateSessionRequest; import org.elasticsearch.xpack.core.security.action.saml.SamlInvalidateSessionResponse; +import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; + import static org.elasticsearch.rest.RestRequest.Method.POST; /** @@ -45,12 +48,22 @@ public class RestSamlInvalidateSessionAction extends SamlBaseRestHandler { PARSER.declareString(SamlInvalidateSessionRequest::setRealmName, new ParseField("realm")); } - public RestSamlInvalidateSessionAction(Settings settings, RestController controller, XPackLicenseState licenseState) { + public RestSamlInvalidateSessionAction(Settings settings, XPackLicenseState licenseState) { super(settings, licenseState); + } + + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - POST, "/_security/saml/invalidate", this, - POST, "/_xpack/security/saml/invalidate", deprecationLogger); + return Collections.singletonList( + new ReplacedRestApi(POST, "/_security/saml/invalidate", + POST, "/_xpack/security/saml/invalidate", deprecationLogger) + ); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/saml/RestSamlLogoutAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/saml/RestSamlLogoutAction.java index 3a584664073b9..a40ce0cd4c069 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/saml/RestSamlLogoutAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/saml/RestSamlLogoutAction.java @@ -5,8 +5,6 @@ */ package org.elasticsearch.xpack.security.rest.action.saml; -import java.io.IOException; - import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.ParseField; @@ -17,8 +15,8 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -26,6 +24,11 @@ import org.elasticsearch.xpack.core.security.action.saml.SamlLogoutRequest; import org.elasticsearch.xpack.core.security.action.saml.SamlLogoutResponse; +import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; + import static org.elasticsearch.rest.RestRequest.Method.POST; /** @@ -44,12 +47,22 @@ public class RestSamlLogoutAction extends SamlBaseRestHandler { PARSER.declareString(SamlLogoutRequest::setRefreshToken, new ParseField("refresh_token")); } - public RestSamlLogoutAction(Settings settings, RestController controller, XPackLicenseState licenseState) { + public RestSamlLogoutAction(Settings settings, XPackLicenseState licenseState) { super(settings, licenseState); + } + + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - POST, "/_security/saml/logout", this, - POST, "/_xpack/security/saml/logout", deprecationLogger); + return Collections.singletonList( + new ReplacedRestApi(POST, "/_security/saml/logout", + POST, "/_xpack/security/saml/logout", deprecationLogger) + ); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/saml/RestSamlPrepareAuthenticationAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/saml/RestSamlPrepareAuthenticationAction.java index b227f2c767f67..02b2a4c9a2a3a 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/saml/RestSamlPrepareAuthenticationAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/saml/RestSamlPrepareAuthenticationAction.java @@ -5,8 +5,6 @@ */ package org.elasticsearch.xpack.security.rest.action.saml; -import java.io.IOException; - import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.ParseField; @@ -17,8 +15,8 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -26,6 +24,11 @@ import org.elasticsearch.xpack.core.security.action.saml.SamlPrepareAuthenticationRequest; import org.elasticsearch.xpack.core.security.action.saml.SamlPrepareAuthenticationResponse; +import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; + import static org.elasticsearch.rest.RestRequest.Method.POST; /** @@ -47,12 +50,22 @@ public class RestSamlPrepareAuthenticationAction extends SamlBaseRestHandler { PARSER.declareString(SamlPrepareAuthenticationRequest::setRelayState, new ParseField("relay_state")); } - public RestSamlPrepareAuthenticationAction(Settings settings, RestController controller, XPackLicenseState licenseState) { + public RestSamlPrepareAuthenticationAction(Settings settings, XPackLicenseState licenseState) { super(settings, licenseState); + } + + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - POST, "/_security/saml/prepare", this, - POST, "/_xpack/security/saml/prepare", deprecationLogger); + return Collections.singletonList( + new ReplacedRestApi(POST, "/_security/saml/prepare", + POST, "/_xpack/security/saml/prepare", deprecationLogger) + ); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestChangePasswordAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestChangePasswordAction.java index 4f1d3c2377555..6bf518830bce5 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestChangePasswordAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestChangePasswordAction.java @@ -13,8 +13,8 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -28,7 +28,10 @@ import org.elasticsearch.xpack.security.rest.action.SecurityBaseRestHandler; import java.io.IOException; +import java.util.Arrays; import java.util.Collections; +import java.util.List; +import java.util.Map; import java.util.Set; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -40,24 +43,30 @@ public class RestChangePasswordAction extends SecurityBaseRestHandler implements private final SecurityContext securityContext; private final Hasher passwordHasher; - public RestChangePasswordAction(Settings settings, RestController controller, SecurityContext securityContext, - XPackLicenseState licenseState) { + public RestChangePasswordAction(Settings settings, SecurityContext securityContext, XPackLicenseState licenseState) { super(settings, licenseState); this.securityContext = securityContext; passwordHasher = Hasher.resolve(XPackSettings.PASSWORD_HASHING_ALGORITHM.get(settings)); + } + + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - POST, "/_security/user/{username}/_password", this, - POST, "/_xpack/security/user/{username}/_password", deprecationLogger); - controller.registerWithDeprecatedHandler( - PUT, "/_security/user/{username}/_password", this, - PUT, "/_xpack/security/user/{username}/_password", deprecationLogger); - controller.registerWithDeprecatedHandler( - POST, "/_security/user/_password", this, - POST, "/_xpack/security/user/_password", deprecationLogger); - controller.registerWithDeprecatedHandler( - PUT, "/_security/user/_password", this, - PUT, "/_xpack/security/user/_password", deprecationLogger); + return Collections.unmodifiableList(Arrays.asList( + new ReplacedRestApi(PUT, "/_security/user/{username}/_password", + PUT, "/_xpack/security/user/{username}/_password", deprecationLogger), + new ReplacedRestApi(POST, "/_security/user/{username}/_password", + POST, "/_xpack/security/user/{username}/_password", deprecationLogger), + new ReplacedRestApi(PUT, "/_security/user/_password", + PUT, "/_xpack/security/user/_password", deprecationLogger), + new ReplacedRestApi(POST, "/_security/user/_password", + POST, "/_xpack/security/user/_password", deprecationLogger) + )); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestDeleteUserAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestDeleteUserAction.java index bc0eb728c6bf6..0dd57b26e1f1a 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestDeleteUserAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestDeleteUserAction.java @@ -12,8 +12,8 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -22,6 +22,9 @@ import org.elasticsearch.xpack.security.rest.action.SecurityBaseRestHandler; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.DELETE; @@ -32,12 +35,21 @@ public class RestDeleteUserAction extends SecurityBaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestDeleteUserAction.class)); - public RestDeleteUserAction(Settings settings, RestController controller, XPackLicenseState licenseState) { + public RestDeleteUserAction(Settings settings, XPackLicenseState licenseState) { super(settings, licenseState); + } + + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - DELETE, "/_security/user/{username}", this, - DELETE, "/_xpack/security/user/{username}", deprecationLogger); + return Collections.singletonList( + new ReplacedRestApi(DELETE, "/_security/user/{username}", DELETE, "/_xpack/security/user/{username}", deprecationLogger) + ); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestGetUserPrivilegesAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestGetUserPrivilegesAction.java index 02bfc7ff96c16..fcd9eb6346cbe 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestGetUserPrivilegesAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestGetUserPrivilegesAction.java @@ -15,8 +15,8 @@ import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestChannel; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -31,6 +31,8 @@ import java.io.IOException; import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.GET; @@ -43,14 +45,22 @@ public class RestGetUserPrivilegesAction extends SecurityBaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestGetUserPrivilegesAction.class)); - public RestGetUserPrivilegesAction(Settings settings, RestController controller, SecurityContext securityContext, - XPackLicenseState licenseState) { + public RestGetUserPrivilegesAction(Settings settings, SecurityContext securityContext, XPackLicenseState licenseState) { super(settings, licenseState); this.securityContext = securityContext; + } + + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - GET, "/_security/user/_privileges", this, - GET, "/_xpack/security/user/_privileges", deprecationLogger); + return Collections.singletonList( + new ReplacedRestApi(GET, "/_security/user/_privileges", GET, "/_xpack/security/user/_privileges", deprecationLogger) + ); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestGetUsersAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestGetUsersAction.java index eef11d478ca65..1a842af3d66f9 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestGetUsersAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestGetUsersAction.java @@ -13,8 +13,8 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -24,6 +24,10 @@ import org.elasticsearch.xpack.security.rest.action.SecurityBaseRestHandler; import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.GET; @@ -34,15 +38,22 @@ public class RestGetUsersAction extends SecurityBaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestGetUsersAction.class)); - public RestGetUsersAction(Settings settings, RestController controller, XPackLicenseState licenseState) { + public RestGetUsersAction(Settings settings, XPackLicenseState licenseState) { super(settings, licenseState); + } + + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - GET, "/_security/user/", this, - GET, "/_xpack/security/user/", deprecationLogger); - controller.registerWithDeprecatedHandler( - GET, "/_security/user/{username}", this, - GET, "/_xpack/security/user/{username}", deprecationLogger); + return Collections.unmodifiableList(Arrays.asList( + new ReplacedRestApi(GET, "/_security/user/", GET, "/_xpack/security/user/", deprecationLogger), + new ReplacedRestApi(GET, "/_security/user/{username}", GET, "/_xpack/security/user/{username}", deprecationLogger) + )); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestHasPrivilegesAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestHasPrivilegesAction.java index 3c589e7220aa7..2bce3b6dbcf8f 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestHasPrivilegesAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestHasPrivilegesAction.java @@ -17,8 +17,8 @@ import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -30,6 +30,10 @@ import org.elasticsearch.xpack.security.rest.action.SecurityBaseRestHandler; import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -43,23 +47,29 @@ public class RestHasPrivilegesAction extends SecurityBaseRestHandler { private final SecurityContext securityContext; private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestHasPrivilegesAction.class)); - public RestHasPrivilegesAction(Settings settings, RestController controller, SecurityContext securityContext, - XPackLicenseState licenseState) { + public RestHasPrivilegesAction(Settings settings, SecurityContext securityContext, XPackLicenseState licenseState) { super(settings, licenseState); this.securityContext = securityContext; + } + + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - GET, "/_security/user/{username}/_has_privileges", this, - GET, "/_xpack/security/user/{username}/_has_privileges", deprecationLogger); - controller.registerWithDeprecatedHandler( - POST, "/_security/user/{username}/_has_privileges", this, - POST, "/_xpack/security/user/{username}/_has_privileges", deprecationLogger); - controller.registerWithDeprecatedHandler( - GET, "/_security/user/_has_privileges", this, - GET, "/_xpack/security/user/_has_privileges", deprecationLogger); - controller.registerWithDeprecatedHandler( - POST, "/_security/user/_has_privileges", this, - POST, "/_xpack/security/user/_has_privileges", deprecationLogger); + return Collections.unmodifiableList(Arrays.asList( + new ReplacedRestApi(GET, "/_security/user/{username}/_has_privileges", + GET, "/_xpack/security/user/{username}/_has_privileges", deprecationLogger), + new ReplacedRestApi(POST, "/_security/user/{username}/_has_privileges", + POST, "/_xpack/security/user/{username}/_has_privileges", deprecationLogger), + new ReplacedRestApi(GET, "/_security/user/_has_privileges", + GET, "/_xpack/security/user/_has_privileges", deprecationLogger), + new ReplacedRestApi(POST, "/_security/user/_has_privileges", + POST, "/_xpack/security/user/_has_privileges", deprecationLogger) + )); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestPutUserAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestPutUserAction.java index 39cd5f35fa54b..18d70177775ec 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestPutUserAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestPutUserAction.java @@ -13,8 +13,8 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -26,7 +26,10 @@ import org.elasticsearch.xpack.security.rest.action.SecurityBaseRestHandler; import java.io.IOException; +import java.util.Arrays; import java.util.Collections; +import java.util.List; +import java.util.Map; import java.util.Set; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -40,16 +43,25 @@ public class RestPutUserAction extends SecurityBaseRestHandler implements RestRe private final Hasher passwordHasher; private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestPutUserAction.class)); - public RestPutUserAction(Settings settings, RestController controller, XPackLicenseState licenseState) { + public RestPutUserAction(Settings settings, XPackLicenseState licenseState) { super(settings, licenseState); passwordHasher = Hasher.resolve(XPackSettings.PASSWORD_HASHING_ALGORITHM.get(settings)); + } + + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - POST, "/_security/user/{username}", this, - POST, "/_xpack/security/user/{username}", deprecationLogger); - controller.registerWithDeprecatedHandler( - PUT, "/_security/user/{username}", this, - PUT, "/_xpack/security/user/{username}", deprecationLogger); + return Collections.unmodifiableList(Arrays.asList( + new ReplacedRestApi(POST, "/_security/user/{username}", + POST, "/_xpack/security/user/{username}", deprecationLogger), + new ReplacedRestApi(PUT, "/_security/user/{username}", + PUT, "/_xpack/security/user/{username}", deprecationLogger) + )); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestSetEnabledAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestSetEnabledAction.java index b13f0b328d993..30422a0275f46 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestSetEnabledAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestSetEnabledAction.java @@ -12,8 +12,8 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -22,6 +22,10 @@ import org.elasticsearch.xpack.security.rest.action.SecurityBaseRestHandler; import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.RestRequest.Method.PUT; @@ -34,21 +38,28 @@ public class RestSetEnabledAction extends SecurityBaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestSetEnabledAction.class)); - public RestSetEnabledAction(Settings settings, RestController controller, XPackLicenseState licenseState) { + public RestSetEnabledAction(Settings settings, XPackLicenseState licenseState) { super(settings, licenseState); + } + + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - POST, "/_security/user/{username}/_enable", this, - POST, "/_xpack/security/user/{username}/_enable", deprecationLogger); - controller.registerWithDeprecatedHandler( - PUT, "/_security/user/{username}/_enable", this, - PUT, "/_xpack/security/user/{username}/_enable", deprecationLogger); - controller.registerWithDeprecatedHandler( - POST, "/_security/user/{username}/_disable", this, - POST, "/_xpack/security/user/{username}/_disable", deprecationLogger); - controller.registerWithDeprecatedHandler( - PUT, "/_security/user/{username}/_disable", this, - PUT, "/_xpack/security/user/{username}/_disable", deprecationLogger); + return Collections.unmodifiableList(Arrays.asList( + new ReplacedRestApi(POST, "/_security/user/{username}/_enable", + POST, "/_xpack/security/user/{username}/_enable", deprecationLogger), + new ReplacedRestApi(PUT, "/_security/user/{username}/_enable", + PUT, "/_xpack/security/user/{username}/_enable", deprecationLogger), + new ReplacedRestApi(POST, "/_security/user/{username}/_disable", + POST, "/_xpack/security/user/{username}/_disable", deprecationLogger), + new ReplacedRestApi(PUT, "/_security/user/{username}/_disable", + PUT, "/_xpack/security/user/{username}/_disable", deprecationLogger) + )); } @Override @@ -58,6 +69,7 @@ public String getName() { @Override public RestChannelConsumer innerPrepareRequest(RestRequest request, NodeClient client) throws IOException { + // TODO consider splitting up enable and disable to have their own rest handler final boolean enabled = request.path().endsWith("_enable"); assert enabled || request.path().endsWith("_disable"); final String username = request.param("username"); diff --git a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/rest/action/SecurityBaseRestHandlerTests.java b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/rest/action/SecurityBaseRestHandlerTests.java index 4b40d165b5e49..4318be0cc965f 100644 --- a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/rest/action/SecurityBaseRestHandlerTests.java +++ b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/rest/action/SecurityBaseRestHandlerTests.java @@ -10,11 +10,15 @@ import org.elasticsearch.license.License; import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.rest.FakeRestChannel; import org.elasticsearch.test.rest.FakeRestRequest; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; import java.util.concurrent.atomic.AtomicBoolean; import static org.mockito.Mockito.mock; @@ -39,6 +43,11 @@ public String getName() { return "test_xpack_security_base_action"; } + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + @Override protected RestChannelConsumer innerPrepareRequest(RestRequest request, NodeClient client) throws IOException { return channel -> { diff --git a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/rest/action/apikey/RestCreateApiKeyActionTests.java b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/rest/action/apikey/RestCreateApiKeyActionTests.java index 3f9b743c8e788..e51a4bfe09ebe 100644 --- a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/rest/action/apikey/RestCreateApiKeyActionTests.java +++ b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/rest/action/apikey/RestCreateApiKeyActionTests.java @@ -8,10 +8,10 @@ import org.apache.lucene.util.SetOnce; import org.elasticsearch.ElasticsearchSecurityException; -import org.elasticsearch.action.ActionType; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.ActionRequest; import org.elasticsearch.action.ActionResponse; +import org.elasticsearch.action.ActionType; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.bytes.BytesArray; import org.elasticsearch.common.settings.SecureString; @@ -22,7 +22,6 @@ import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.AbstractRestChannel; import org.elasticsearch.rest.RestChannel; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.test.ESTestCase; @@ -42,7 +41,6 @@ public class RestCreateApiKeyActionTests extends ESTestCase { private final XPackLicenseState mockLicenseState = mock(XPackLicenseState.class); - private final RestController mockRestController = mock(RestController.class); private Settings settings = null; private ThreadPool threadPool = null; @@ -98,8 +96,7 @@ void doExecute(ActionType action, Request request, ActionListener action, Request request, ActionListener action, Request request, ActionListener action, Request request, ActionListener action, Request request, ActionListener> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + @Override protected RestChannelConsumer innerPrepareRequest(RestRequest request, NodeClient client) { return null; diff --git a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/rest/action/user/RestGetUserPrivilegesActionTests.java b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/rest/action/user/RestGetUserPrivilegesActionTests.java index 16c9218058f1c..fd2418c09f7dc 100644 --- a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/rest/action/user/RestGetUserPrivilegesActionTests.java +++ b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/rest/action/user/RestGetUserPrivilegesActionTests.java @@ -13,7 +13,6 @@ import org.elasticsearch.common.util.set.Sets; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.license.XPackLicenseState; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.rest.FakeRestChannel; @@ -41,8 +40,8 @@ public class RestGetUserPrivilegesActionTests extends ESTestCase { public void testBasicLicense() throws Exception { final XPackLicenseState licenseState = mock(XPackLicenseState.class); - final RestGetUserPrivilegesAction action = new RestGetUserPrivilegesAction(Settings.EMPTY, mock(RestController.class), - mock(SecurityContext.class), licenseState); + final RestGetUserPrivilegesAction action = + new RestGetUserPrivilegesAction(Settings.EMPTY, mock(SecurityContext.class), licenseState); when(licenseState.isSecurityAvailable()).thenReturn(false); final FakeRestRequest request = new FakeRestRequest(); final FakeRestChannel channel = new FakeRestChannel(request, true, 1); diff --git a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/rest/action/user/RestHasPrivilegesActionTests.java b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/rest/action/user/RestHasPrivilegesActionTests.java index d0173479f37d6..50561f427b9b8 100644 --- a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/rest/action/user/RestHasPrivilegesActionTests.java +++ b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/rest/action/user/RestHasPrivilegesActionTests.java @@ -13,7 +13,6 @@ import org.elasticsearch.common.xcontent.json.JsonXContent; import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.RestChannel; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.test.ESTestCase; @@ -39,7 +38,7 @@ public class RestHasPrivilegesActionTests extends ESTestCase { public void testBodyConsumed() throws Exception { final XPackLicenseState licenseState = mock(XPackLicenseState.class); final RestHasPrivilegesAction action = - new RestHasPrivilegesAction(Settings.EMPTY, mock(RestController.class), mock(SecurityContext.class), licenseState); + new RestHasPrivilegesAction(Settings.EMPTY, mock(SecurityContext.class), licenseState); try (XContentBuilder bodyBuilder = JsonXContent.contentBuilder().startObject().endObject()) { final RestRequest request = new FakeRestRequest.Builder(xContentRegistry()) .withPath("/_security/user/_has_privileges/") @@ -52,8 +51,8 @@ public void testBodyConsumed() throws Exception { public void testBasicLicense() throws Exception { final XPackLicenseState licenseState = mock(XPackLicenseState.class); - final RestHasPrivilegesAction action = new RestHasPrivilegesAction(Settings.EMPTY, mock(RestController.class), - mock(SecurityContext.class), licenseState); + final RestHasPrivilegesAction action = + new RestHasPrivilegesAction(Settings.EMPTY, mock(SecurityContext.class), licenseState); when(licenseState.isSecurityAvailable()).thenReturn(false); try (XContentBuilder bodyBuilder = JsonXContent.contentBuilder().startObject().endObject()) { final RestRequest request = new FakeRestRequest.Builder(xContentRegistry()) diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlClearCursorAction.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlClearCursorAction.java index 88713eb4a8fae..092779b0b8d90 100644 --- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlClearCursorAction.java +++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlClearCursorAction.java @@ -9,21 +9,26 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.sql.action.SqlClearCursorAction; import org.elasticsearch.xpack.sql.action.SqlClearCursorRequest; import org.elasticsearch.xpack.sql.proto.Protocol; import java.io.IOException; +import java.util.List; +import java.util.Map; +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestSqlClearCursorAction extends BaseRestHandler { - public RestSqlClearCursorAction(RestController controller) { - controller.registerHandler(POST, Protocol.CLEAR_CURSOR_REST_ENDPOINT, this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap(Protocol.CLEAR_CURSOR_REST_ENDPOINT, singletonList(POST)); } @Override diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlQueryAction.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlQueryAction.java index f275475530ad4..990687171bc39 100644 --- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlQueryAction.java +++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlQueryAction.java @@ -12,8 +12,8 @@ import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestResponseListener; @@ -25,15 +25,20 @@ import java.io.IOException; import java.nio.charset.StandardCharsets; +import java.util.List; +import java.util.Map; +import static java.util.Arrays.asList; +import static java.util.Collections.singletonMap; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestSqlQueryAction extends BaseRestHandler { - public RestSqlQueryAction(RestController controller) { - controller.registerHandler(GET, Protocol.SQL_QUERY_REST_ENDPOINT, this); - controller.registerHandler(POST, Protocol.SQL_QUERY_REST_ENDPOINT, this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap(Protocol.SQL_QUERY_REST_ENDPOINT, unmodifiableList(asList(GET, POST))); } @Override diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlStatsAction.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlStatsAction.java index 8bb6c3328b382..830dfe020ea27 100644 --- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlStatsAction.java +++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlStatsAction.java @@ -8,17 +8,23 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestActions; import org.elasticsearch.xpack.sql.proto.Protocol; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestSqlStatsAction extends BaseRestHandler { - protected RestSqlStatsAction(RestController controller) { - controller.registerHandler(GET, Protocol.SQL_STATS_REST_ENDPOINT, this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap(Protocol.SQL_STATS_REST_ENDPOINT, singletonList(GET)); } @Override diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlTranslateAction.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlTranslateAction.java index b445789422e6e..e3e8b389e2ad0 100644 --- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlTranslateAction.java +++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlTranslateAction.java @@ -8,15 +8,20 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.sql.action.SqlTranslateAction; import org.elasticsearch.xpack.sql.action.SqlTranslateRequest; import org.elasticsearch.xpack.sql.proto.Protocol; import java.io.IOException; +import java.util.List; +import java.util.Map; +import static java.util.Arrays.asList; +import static java.util.Collections.singletonMap; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -25,9 +30,9 @@ */ public class RestSqlTranslateAction extends BaseRestHandler { - public RestSqlTranslateAction(RestController controller) { - controller.registerHandler(GET, Protocol.SQL_TRANSLATE_REST_ENDPOINT, this); - controller.registerHandler(POST, Protocol.SQL_TRANSLATE_REST_ENDPOINT, this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap(Protocol.SQL_TRANSLATE_REST_ENDPOINT, unmodifiableList(asList(GET, POST))); } @Override diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/SqlPlugin.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/SqlPlugin.java index dbe14f99f3365..db9c0246210cd 100644 --- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/SqlPlugin.java +++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/SqlPlugin.java @@ -115,10 +115,10 @@ public List getRestHandlers(Settings settings, RestController restC return emptyList(); } - return Arrays.asList(new RestSqlQueryAction(restController), - new RestSqlTranslateAction(restController), - new RestSqlClearCursorAction(restController), - new RestSqlStatsAction(restController)); + return Arrays.asList(new RestSqlQueryAction(), + new RestSqlTranslateAction(), + new RestSqlClearCursorAction(), + new RestSqlStatsAction()); } @Override diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/Transform.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/Transform.java index 99a46a02d41d5..8c71f0b9c6e65 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/Transform.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/Transform.java @@ -162,24 +162,24 @@ public List getRestHandlers( } return Arrays.asList( - new RestPutTransformAction(restController), - new RestStartTransformAction(restController), - new RestStopTransformAction(restController), - new RestDeleteTransformAction(restController), - new RestGetTransformAction(restController), - new RestGetTransformStatsAction(restController), - new RestPreviewTransformAction(restController), - new RestUpdateTransformAction(restController), + new RestPutTransformAction(), + new RestStartTransformAction(), + new RestStopTransformAction(), + new RestDeleteTransformAction(), + new RestGetTransformAction(), + new RestGetTransformStatsAction(), + new RestPreviewTransformAction(), + new RestUpdateTransformAction(), // deprecated endpoints, to be removed for 8.0.0 - new RestPutTransformActionDeprecated(restController), - new RestStartTransformActionDeprecated(restController), - new RestStopTransformActionDeprecated(restController), - new RestDeleteTransformActionDeprecated(restController), - new RestGetTransformActionDeprecated(restController), - new RestGetTransformStatsActionDeprecated(restController), - new RestPreviewTransformActionDeprecated(restController), - new RestUpdateTransformActionDeprecated(restController) + new RestPutTransformActionDeprecated(), + new RestStartTransformActionDeprecated(), + new RestStopTransformActionDeprecated(), + new RestDeleteTransformActionDeprecated(), + new RestGetTransformActionDeprecated(), + new RestGetTransformStatsActionDeprecated(), + new RestPreviewTransformActionDeprecated(), + new RestUpdateTransformActionDeprecated() ); } diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestDeleteTransformAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestDeleteTransformAction.java index d6dbe7e468a3e..157118d03c99d 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestDeleteTransformAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestDeleteTransformAction.java @@ -8,16 +8,24 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.transform.TransformField; import org.elasticsearch.xpack.core.transform.action.DeleteTransformAction; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.DELETE; + public class RestDeleteTransformAction extends BaseRestHandler { - public RestDeleteTransformAction(RestController controller) { - controller.registerHandler(RestRequest.Method.DELETE, TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID, this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID, singletonList(DELETE)); } @Override diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestGetTransformAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestGetTransformAction.java index 23484f0e9408f..0151609a8cca4 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestGetTransformAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestGetTransformAction.java @@ -7,21 +7,31 @@ package org.elasticsearch.xpack.transform.rest.action; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.action.util.PageParams; import org.elasticsearch.xpack.core.transform.TransformField; import org.elasticsearch.xpack.core.transform.action.GetTransformAction; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.xpack.core.transform.TransformField.ALLOW_NO_MATCH; public class RestGetTransformAction extends BaseRestHandler { - public RestGetTransformAction(RestController controller) { - controller.registerHandler(RestRequest.Method.GET, TransformField.REST_BASE_PATH_TRANSFORMS, this); - controller.registerHandler(RestRequest.Method.GET, TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID, this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put(TransformField.REST_BASE_PATH_TRANSFORMS, singletonList(GET)) + .put(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID, singletonList(GET)) + .map()); } @Override diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestGetTransformStatsAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestGetTransformStatsAction.java index 662f9840d0267..90d73d40dfb3a 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestGetTransformStatsAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestGetTransformStatsAction.java @@ -7,21 +7,31 @@ package org.elasticsearch.xpack.transform.rest.action; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.action.util.PageParams; import org.elasticsearch.xpack.core.transform.TransformField; import org.elasticsearch.xpack.core.transform.action.GetTransformStatsAction; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.xpack.core.transform.TransformField.ALLOW_NO_MATCH; public class RestGetTransformStatsAction extends BaseRestHandler { - public RestGetTransformStatsAction(RestController controller) { - controller.registerHandler(RestRequest.Method.GET, TransformField.REST_BASE_PATH_TRANSFORMS + "_stats", this); - controller.registerHandler(RestRequest.Method.GET, TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID + "_stats", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put(TransformField.REST_BASE_PATH_TRANSFORMS + "_stats", singletonList(GET)) + .put(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID + "_stats", singletonList(GET)) + .map()); } @Override diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestPreviewTransformAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestPreviewTransformAction.java index 114c88b761c65..b2d1f28a8945e 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestPreviewTransformAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestPreviewTransformAction.java @@ -9,18 +9,25 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.transform.TransformField; import org.elasticsearch.xpack.core.transform.action.PreviewTransformAction; import java.io.IOException; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestPreviewTransformAction extends BaseRestHandler { - public RestPreviewTransformAction(RestController controller) { - controller.registerHandler(RestRequest.Method.POST, TransformField.REST_BASE_PATH_TRANSFORMS + "_preview", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap(TransformField.REST_BASE_PATH_TRANSFORMS + "_preview", singletonList(POST)); } @Override diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestPutTransformAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestPutTransformAction.java index b61d81fb6e132..1992841104aa9 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestPutTransformAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestPutTransformAction.java @@ -9,18 +9,25 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.transform.TransformField; import org.elasticsearch.xpack.core.transform.action.PutTransformAction; import java.io.IOException; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.PUT; public class RestPutTransformAction extends BaseRestHandler { - public RestPutTransformAction(RestController controller) { - controller.registerHandler(RestRequest.Method.PUT, TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID, this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID, singletonList(PUT)); } @Override diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestStartTransformAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestStartTransformAction.java index ac6bb368cffab..923c2854ab257 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestStartTransformAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestStartTransformAction.java @@ -9,16 +9,24 @@ import org.elasticsearch.action.support.master.AcknowledgedRequest; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.transform.TransformField; import org.elasticsearch.xpack.core.transform.action.StartTransformAction; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.POST; + public class RestStartTransformAction extends BaseRestHandler { - public RestStartTransformAction(RestController controller) { - controller.registerHandler(RestRequest.Method.POST, TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID + "_start", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID + "_start", singletonList(POST)); } @Override diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestStopTransformAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestStopTransformAction.java index 85d138bfc37fd..d5b6c9855a3f7 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestStopTransformAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestStopTransformAction.java @@ -8,16 +8,24 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.transform.TransformField; import org.elasticsearch.xpack.core.transform.action.StopTransformAction; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.POST; + public class RestStopTransformAction extends BaseRestHandler { - public RestStopTransformAction(RestController controller) { - controller.registerHandler(RestRequest.Method.POST, TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID + "_stop", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID + "_stop", singletonList(POST)); } @Override diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestUpdateTransformAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestUpdateTransformAction.java index 563c978641303..1cae8b67f9735 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestUpdateTransformAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestUpdateTransformAction.java @@ -9,18 +9,25 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.transform.TransformField; import org.elasticsearch.xpack.core.transform.action.UpdateTransformAction; import java.io.IOException; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestUpdateTransformAction extends BaseRestHandler { - public RestUpdateTransformAction(RestController controller) { - controller.registerHandler(RestRequest.Method.POST, TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID + "_update", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID + "_update", singletonList(POST)); } @Override diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestDeleteTransformActionDeprecated.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestDeleteTransformActionDeprecated.java index 94d4b5c65433b..d4d25628f7d39 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestDeleteTransformActionDeprecated.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestDeleteTransformActionDeprecated.java @@ -10,22 +10,35 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.transform.TransformField; import org.elasticsearch.xpack.core.transform.TransformMessages; import org.elasticsearch.xpack.core.transform.action.DeleteTransformAction; import org.elasticsearch.xpack.core.transform.action.compat.DeleteTransformActionDeprecated; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static org.elasticsearch.rest.RestRequest.Method.DELETE; + public class RestDeleteTransformActionDeprecated extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger( LogManager.getLogger(RestDeleteTransformActionDeprecated.class)); - public RestDeleteTransformActionDeprecated(RestController controller) { - controller.registerAsDeprecatedHandler(RestRequest.Method.DELETE, TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID_DEPRECATED, this, - TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger); + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List deprecatedHandledMethodsAndPaths() { + return singletonList(new DeprecatedRestApi(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID_DEPRECATED, + singletonList(DELETE), TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger)); } @Override diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestGetTransformActionDeprecated.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestGetTransformActionDeprecated.java index ca92942a52dd1..d6520b7838e3b 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestGetTransformActionDeprecated.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestGetTransformActionDeprecated.java @@ -10,8 +10,8 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.action.util.PageParams; import org.elasticsearch.xpack.core.transform.TransformField; @@ -19,6 +19,14 @@ import org.elasticsearch.xpack.core.transform.action.GetTransformAction; import org.elasticsearch.xpack.core.transform.action.compat.GetTransformActionDeprecated; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import static java.util.Arrays.asList; +import static java.util.Collections.singletonList; +import static java.util.Collections.unmodifiableList; +import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.xpack.core.transform.TransformField.ALLOW_NO_MATCH; public class RestGetTransformActionDeprecated extends BaseRestHandler { @@ -26,11 +34,18 @@ public class RestGetTransformActionDeprecated extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger( LogManager.getLogger(RestGetTransformActionDeprecated.class)); - public RestGetTransformActionDeprecated(RestController controller) { - controller.registerAsDeprecatedHandler(RestRequest.Method.GET, TransformField.REST_BASE_PATH_TRANSFORMS_DEPRECATED, this, - TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger); - controller.registerAsDeprecatedHandler(RestRequest.Method.GET, TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID_DEPRECATED, this, - TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger); + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List deprecatedHandledMethodsAndPaths() { + return unmodifiableList(asList( + new DeprecatedRestApi(TransformField.REST_BASE_PATH_TRANSFORMS_DEPRECATED, singletonList(GET), + TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger), + new DeprecatedRestApi(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID_DEPRECATED, singletonList(GET), + TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger))); } @Override diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestGetTransformStatsActionDeprecated.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestGetTransformStatsActionDeprecated.java index b444ea3beef14..96b1efdcf6e2f 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestGetTransformStatsActionDeprecated.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestGetTransformStatsActionDeprecated.java @@ -10,8 +10,8 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.action.util.PageParams; import org.elasticsearch.xpack.core.transform.TransformField; @@ -19,6 +19,14 @@ import org.elasticsearch.xpack.core.transform.action.GetTransformStatsAction; import org.elasticsearch.xpack.core.transform.action.compat.GetTransformStatsActionDeprecated; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import static java.util.Arrays.asList; +import static java.util.Collections.singletonList; +import static java.util.Collections.unmodifiableList; +import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.xpack.core.transform.TransformField.ALLOW_NO_MATCH; public class RestGetTransformStatsActionDeprecated extends BaseRestHandler { @@ -26,12 +34,18 @@ public class RestGetTransformStatsActionDeprecated extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger( LogManager.getLogger(RestGetTransformStatsActionDeprecated.class)); - public RestGetTransformStatsActionDeprecated(RestController controller) { - controller.registerAsDeprecatedHandler(RestRequest.Method.GET, TransformField.REST_BASE_PATH_TRANSFORMS_DEPRECATED + "_stats", - this, TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger); - controller.registerAsDeprecatedHandler(RestRequest.Method.GET, - TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID_DEPRECATED + "_stats", this, - TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger); + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List deprecatedHandledMethodsAndPaths() { + return unmodifiableList(asList( + new DeprecatedRestApi(TransformField.REST_BASE_PATH_TRANSFORMS_DEPRECATED + "_stats", singletonList(GET), + TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger), + new DeprecatedRestApi(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID_DEPRECATED + "_stats", singletonList(GET), + TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger))); } @Override diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestPreviewTransformActionDeprecated.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestPreviewTransformActionDeprecated.java index 8c0a994ebbeff..784afc85e738d 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestPreviewTransformActionDeprecated.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestPreviewTransformActionDeprecated.java @@ -11,8 +11,8 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.transform.TransformField; import org.elasticsearch.xpack.core.transform.TransformMessages; @@ -20,15 +20,27 @@ import org.elasticsearch.xpack.core.transform.action.compat.PreviewTransformActionDeprecated; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestPreviewTransformActionDeprecated extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger( LogManager.getLogger(RestPreviewTransformActionDeprecated.class)); - public RestPreviewTransformActionDeprecated(RestController controller) { - controller.registerAsDeprecatedHandler(RestRequest.Method.POST, TransformField.REST_BASE_PATH_TRANSFORMS_DEPRECATED + "_preview", - this, TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger); + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List deprecatedHandledMethodsAndPaths() { + return singletonList(new DeprecatedRestApi(TransformField.REST_BASE_PATH_TRANSFORMS_DEPRECATED + "_preview", + singletonList(POST), TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger)); } @Override diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestPutTransformActionDeprecated.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestPutTransformActionDeprecated.java index aeac2c91be2f9..a5ebec79f6bdc 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestPutTransformActionDeprecated.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestPutTransformActionDeprecated.java @@ -11,8 +11,8 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.transform.TransformField; import org.elasticsearch.xpack.core.transform.TransformMessages; @@ -20,15 +20,27 @@ import org.elasticsearch.xpack.core.transform.action.compat.PutTransformActionDeprecated; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static org.elasticsearch.rest.RestRequest.Method.PUT; public class RestPutTransformActionDeprecated extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger( LogManager.getLogger(RestPutTransformActionDeprecated.class)); - public RestPutTransformActionDeprecated(RestController controller) { - controller.registerAsDeprecatedHandler(RestRequest.Method.PUT, TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID_DEPRECATED, this, - TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger); + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List deprecatedHandledMethodsAndPaths() { + return singletonList(new DeprecatedRestApi(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID_DEPRECATED, singletonList(PUT), + TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger)); } @Override diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestStartTransformActionDeprecated.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestStartTransformActionDeprecated.java index 796c9833222aa..326827d652e25 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestStartTransformActionDeprecated.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestStartTransformActionDeprecated.java @@ -11,23 +11,35 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.transform.TransformField; import org.elasticsearch.xpack.core.transform.TransformMessages; import org.elasticsearch.xpack.core.transform.action.StartTransformAction; import org.elasticsearch.xpack.core.transform.action.compat.StartTransformActionDeprecated; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static org.elasticsearch.rest.RestRequest.Method.POST; + public class RestStartTransformActionDeprecated extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger( LogManager.getLogger(RestStartTransformActionDeprecated.class)); - public RestStartTransformActionDeprecated(RestController controller) { - controller.registerAsDeprecatedHandler(RestRequest.Method.POST, - TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID_DEPRECATED + "_start", this, TransformMessages.REST_DEPRECATED_ENDPOINT, - deprecationLogger); + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List deprecatedHandledMethodsAndPaths() { + return singletonList(new DeprecatedRestApi(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID_DEPRECATED + "_start", + singletonList(POST), TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger)); } @Override diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestStopTransformActionDeprecated.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestStopTransformActionDeprecated.java index 2a43df2a7f94d..637100fc5abc0 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestStopTransformActionDeprecated.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestStopTransformActionDeprecated.java @@ -10,22 +10,35 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.transform.TransformField; import org.elasticsearch.xpack.core.transform.TransformMessages; import org.elasticsearch.xpack.core.transform.action.StopTransformAction; import org.elasticsearch.xpack.core.transform.action.compat.StopTransformActionDeprecated; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static org.elasticsearch.rest.RestRequest.Method.POST; + public class RestStopTransformActionDeprecated extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger( LogManager.getLogger(RestStopTransformActionDeprecated.class)); - public RestStopTransformActionDeprecated(RestController controller) { - controller.registerAsDeprecatedHandler(RestRequest.Method.POST, TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID_DEPRECATED + "_stop", - this, TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger); + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List deprecatedHandledMethodsAndPaths() { + return singletonList(new DeprecatedRestApi(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID_DEPRECATED + "_stop", singletonList(POST), + TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger)); } @Override diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestUpdateTransformActionDeprecated.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestUpdateTransformActionDeprecated.java index 5be2586f955e8..48bc7a4d028ba 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestUpdateTransformActionDeprecated.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestUpdateTransformActionDeprecated.java @@ -11,8 +11,8 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.transform.TransformField; import org.elasticsearch.xpack.core.transform.TransformMessages; @@ -20,16 +20,27 @@ import org.elasticsearch.xpack.core.transform.action.compat.UpdateTransformActionDeprecated; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestUpdateTransformActionDeprecated extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger( LogManager.getLogger(RestUpdateTransformActionDeprecated.class)); - public RestUpdateTransformActionDeprecated(RestController controller) { - controller.registerAsDeprecatedHandler(RestRequest.Method.POST, - TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID_DEPRECATED + "_update", this, TransformMessages.REST_DEPRECATED_ENDPOINT, - deprecationLogger); + @Override + public Map> handledMethodsAndPaths() { + return Collections.emptyMap(); + } + + @Override + public List deprecatedHandledMethodsAndPaths() { + return singletonList(new DeprecatedRestApi(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID_DEPRECATED + "_update", + singletonList(POST), TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger)); } @Override diff --git a/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/rest/action/RestDeleteTransformActionTests.java b/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/rest/action/RestDeleteTransformActionTests.java index 36891461c2702..7672cf71f65d3 100644 --- a/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/rest/action/RestDeleteTransformActionTests.java +++ b/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/rest/action/RestDeleteTransformActionTests.java @@ -12,7 +12,6 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.common.xcontent.json.JsonXContent; -import org.elasticsearch.rest.RestController; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.rest.FakeRestRequest; @@ -22,8 +21,7 @@ public class RestDeleteTransformActionTests extends ESTestCase { public void testBodyRejection() throws Exception { - final RestDeleteTransformAction handler = new RestDeleteTransformAction( - mock(RestController.class)); + final RestDeleteTransformAction handler = new RestDeleteTransformAction(); try (XContentBuilder builder = JsonXContent.contentBuilder()) { builder.startObject(); { diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/Watcher.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/Watcher.java index d00915f12ad61..b7646930322f7 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/Watcher.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/Watcher.java @@ -137,6 +137,7 @@ import org.elasticsearch.xpack.watcher.notification.slack.SlackService; import org.elasticsearch.xpack.watcher.rest.action.RestAckWatchAction; import org.elasticsearch.xpack.watcher.rest.action.RestActivateWatchAction; +import org.elasticsearch.xpack.watcher.rest.action.RestActivateWatchAction.DeactivateRestHandler; import org.elasticsearch.xpack.watcher.rest.action.RestDeleteWatchAction; import org.elasticsearch.xpack.watcher.rest.action.RestExecuteWatchAction; import org.elasticsearch.xpack.watcher.rest.action.RestGetWatchAction; @@ -557,14 +558,16 @@ public List getRestHandlers(Settings settings, RestController restC return emptyList(); } return Arrays.asList( - new RestPutWatchAction(restController), - new RestDeleteWatchAction(restController), - new RestWatcherStatsAction(restController), - new RestGetWatchAction(restController), - new RestWatchServiceAction(restController), - new RestAckWatchAction(restController), - new RestActivateWatchAction(restController), - new RestExecuteWatchAction(restController)); + new RestPutWatchAction(), + new RestDeleteWatchAction(), + new RestWatcherStatsAction(), + new RestGetWatchAction(), + new RestWatchServiceAction(), + new RestWatchServiceAction.StopRestHandler(), + new RestAckWatchAction(), + new RestActivateWatchAction(), + new DeactivateRestHandler(), + new RestExecuteWatchAction()); } @Override diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestAckWatchAction.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestAckWatchAction.java index f016f253583aa..057be3afc3ab9 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestAckWatchAction.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestAckWatchAction.java @@ -7,11 +7,12 @@ package org.elasticsearch.xpack.watcher.rest.action; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -21,6 +22,12 @@ import org.elasticsearch.xpack.core.watcher.transport.actions.ack.AckWatchResponse; import org.elasticsearch.xpack.core.watcher.watch.WatchField; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.RestRequest.Method.PUT; @@ -29,11 +36,12 @@ */ public class RestAckWatchAction extends BaseRestHandler { - public RestAckWatchAction(RestController controller) { - controller.registerHandler(POST, "/_watcher/watch/{id}/_ack", this); - controller.registerHandler(PUT, "/_watcher/watch/{id}/_ack", this); - controller.registerHandler(POST, "/_watcher/watch/{id}/_ack/{actions}", this); - controller.registerHandler(PUT, "/_watcher/watch/{id}/_ack/{actions}", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_watcher/watch/{id}/_ack", unmodifiableList(asList(POST, PUT))) + .put("/_watcher/watch/{id}/_ack/{actions}", unmodifiableList(asList(POST, PUT))) + .map()); } @Override diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestActivateWatchAction.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestActivateWatchAction.java index 0317854d88b0f..bc0e12db0d58f 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestActivateWatchAction.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestActivateWatchAction.java @@ -10,8 +10,8 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -21,6 +21,12 @@ import org.elasticsearch.xpack.core.watcher.transport.actions.activate.ActivateWatchResponse; import org.elasticsearch.xpack.core.watcher.watch.WatchField; +import java.util.List; +import java.util.Map; + +import static java.util.Arrays.asList; +import static java.util.Collections.singletonMap; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.RestRequest.Method.PUT; @@ -29,13 +35,9 @@ */ public class RestActivateWatchAction extends BaseRestHandler { - public RestActivateWatchAction(RestController controller) { - controller.registerHandler(POST, "/_watcher/watch/{id}/_activate", this); - controller.registerHandler(PUT, "/_watcher/watch/{id}/_activate", this); - - final DeactivateRestHandler deactivateRestHandler = new DeactivateRestHandler(); - controller.registerHandler(POST, "/_watcher/watch/{id}/_deactivate", deactivateRestHandler); - controller.registerHandler(PUT, "/_watcher/watch/{id}/_deactivate", deactivateRestHandler); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_watcher/watch/{id}/_activate", unmodifiableList(asList(POST, PUT))); } @Override @@ -58,9 +60,11 @@ public RestResponse buildResponse(ActivateWatchResponse response, XContentBuilde }); } - private static class DeactivateRestHandler extends BaseRestHandler { + public static class DeactivateRestHandler extends BaseRestHandler { - DeactivateRestHandler() { + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_watcher/watch/{id}/_deactivate", unmodifiableList(asList(POST, PUT))); } @Override diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestDeleteWatchAction.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestDeleteWatchAction.java index dd33b79365d49..0a992f5d8d200 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestDeleteWatchAction.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestDeleteWatchAction.java @@ -12,21 +12,27 @@ import org.elasticsearch.protocol.xpack.watcher.DeleteWatchResponse; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; import org.elasticsearch.xpack.core.watcher.transport.actions.delete.DeleteWatchAction; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.DELETE; import static org.elasticsearch.rest.RestStatus.NOT_FOUND; import static org.elasticsearch.rest.RestStatus.OK; public class RestDeleteWatchAction extends BaseRestHandler { - public RestDeleteWatchAction(RestController controller) { - controller.registerHandler(DELETE, "/_watcher/watch/{id}", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_watcher/watch/{id}", singletonList(DELETE)); } @Override diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestExecuteWatchAction.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestExecuteWatchAction.java index a42161aafc301..6feb2825a02aa 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestExecuteWatchAction.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestExecuteWatchAction.java @@ -10,13 +10,14 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.ParseField; import org.elasticsearch.common.bytes.BytesReference; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.util.set.Sets; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -30,11 +31,13 @@ import org.elasticsearch.xpack.core.watcher.watch.WatchField; import java.io.IOException; -import java.util.Arrays; import java.util.Collections; import java.util.List; +import java.util.Map; import java.util.Set; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.RestRequest.Method.PUT; import static org.elasticsearch.xpack.watcher.rest.action.RestExecuteWatchAction.Field.IGNORE_CONDITION; @@ -42,17 +45,18 @@ public class RestExecuteWatchAction extends BaseRestHandler implements RestRequestFilter { - private static final List RESERVED_FIELD_NAMES = Arrays.asList(WatchField.TRIGGER.getPreferredName(), + private static final List RESERVED_FIELD_NAMES = asList(WatchField.TRIGGER.getPreferredName(), WatchField.INPUT.getPreferredName(), WatchField.CONDITION.getPreferredName(), WatchField.ACTIONS.getPreferredName(), WatchField.TRANSFORM.getPreferredName(), WatchField.THROTTLE_PERIOD.getPreferredName(), WatchField.THROTTLE_PERIOD_HUMAN.getPreferredName(), WatchField.METADATA.getPreferredName(), WatchField.STATUS.getPreferredName()); - public RestExecuteWatchAction(RestController controller) { - controller.registerHandler(POST, "/_watcher/watch/{id}/_execute", this); - controller.registerHandler(PUT, "/_watcher/watch/{id}/_execute", this); - controller.registerHandler(POST, "/_watcher/watch/_execute", this); - controller.registerHandler(PUT, "/_watcher/watch/_execute", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_watcher/watch/{id}/_execute", unmodifiableList(asList(POST, PUT))) + .put("/_watcher/watch/_execute", unmodifiableList(asList(POST, PUT))) + .map()); } @Override diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestGetWatchAction.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestGetWatchAction.java index 1001c8181467a..13517c268c387 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestGetWatchAction.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestGetWatchAction.java @@ -10,8 +10,8 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -19,14 +19,20 @@ import org.elasticsearch.xpack.core.watcher.transport.actions.get.GetWatchRequest; import org.elasticsearch.xpack.core.watcher.transport.actions.get.GetWatchResponse; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestStatus.NOT_FOUND; import static org.elasticsearch.rest.RestStatus.OK; public class RestGetWatchAction extends BaseRestHandler { - public RestGetWatchAction(RestController controller) { - controller.registerHandler(GET, "/_watcher/watch/{id}", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_watcher/watch/{id}", singletonList(GET)); } @Override diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestPutWatchAction.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestPutWatchAction.java index 2240c789c53f2..dc4fc1c859909 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestPutWatchAction.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestPutWatchAction.java @@ -14,8 +14,8 @@ import org.elasticsearch.protocol.xpack.watcher.PutWatchResponse; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -23,8 +23,13 @@ import org.elasticsearch.xpack.core.watcher.transport.actions.put.PutWatchAction; import java.util.Collections; +import java.util.List; +import java.util.Map; import java.util.Set; +import static java.util.Arrays.asList; +import static java.util.Collections.singletonMap; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.RestRequest.Method.PUT; import static org.elasticsearch.rest.RestStatus.CREATED; @@ -32,9 +37,9 @@ public class RestPutWatchAction extends BaseRestHandler implements RestRequestFilter { - public RestPutWatchAction(RestController controller) { - controller.registerHandler(POST, "/_watcher/watch/{id}", this); - controller.registerHandler(PUT, "/_watcher/watch/{id}", this); + @Override + public Map> handledMethodsAndPaths() { + return singletonMap("/_watcher/watch/{id}", unmodifiableList(asList(POST, PUT))); } @Override diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatchServiceAction.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatchServiceAction.java index c59cdffdcb96c..1aa3fa7c49270 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatchServiceAction.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatchServiceAction.java @@ -8,19 +8,24 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.watcher.transport.actions.service.WatcherServiceAction; import org.elasticsearch.xpack.core.watcher.transport.actions.service.WatcherServiceRequest; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.singletonList; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestWatchServiceAction extends BaseRestHandler { - public RestWatchServiceAction(RestController controller) { - controller.registerHandler(POST, "/_watcher/_start", this); - controller.registerHandler(POST, "/_watcher/_stop", new StopRestHandler()); + @Override + public Map> handledMethodsAndPaths() { + return Collections.singletonMap("/_watcher/_start", singletonList(POST)); } @Override @@ -34,9 +39,11 @@ public RestChannelConsumer prepareRequest(RestRequest request, NodeClient client client.execute(WatcherServiceAction.INSTANCE, new WatcherServiceRequest().start(), new RestToXContentListener<>(channel)); } - private static class StopRestHandler extends BaseRestHandler { + public static class StopRestHandler extends BaseRestHandler { - StopRestHandler() { + @Override + public Map> handledMethodsAndPaths() { + return Collections.singletonMap("/_watcher/_stop", singletonList(POST)); } @Override diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatcherStatsAction.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatcherStatsAction.java index 60a0e0fb9fcdd..3d6f46a2ba3c8 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatcherStatsAction.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatcherStatsAction.java @@ -10,26 +10,33 @@ import org.apache.logging.log4j.Logger; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestActions; import org.elasticsearch.xpack.core.watcher.transport.actions.stats.WatcherStatsAction; import org.elasticsearch.xpack.core.watcher.transport.actions.stats.WatcherStatsRequest; import java.util.Collections; +import java.util.List; +import java.util.Map; import java.util.Set; +import static java.util.Collections.singletonList; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestWatcherStatsAction extends BaseRestHandler { private static final Logger logger = LogManager.getLogger(RestWatcherStatsAction.class); private static final DeprecationLogger deprecationLogger = new DeprecationLogger(logger); - public RestWatcherStatsAction(RestController controller) { - controller.registerHandler(GET, "/_watcher/stats", this); - controller.registerHandler(GET, "/_watcher/stats/{metric}", this); + @Override + public Map> handledMethodsAndPaths() { + return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() + .put("/_watcher/stats", singletonList(GET)) + .put("/_watcher/stats/{metric}", singletonList(GET)) + .map()); } @Override From 91675129ef6bac903f7b8f24d1037cddd24f629e Mon Sep 17 00:00:00 2001 From: jaymode Date: Wed, 5 Feb 2020 10:51:34 -0700 Subject: [PATCH 02/11] fixes --- .../xpack/ilm/action/RestGetStatusAction.java | 4 ++-- .../xpack/ml/rest/job/RestOpenJobAction.java | 6 +++--- .../modelsnapshots/RestRevertModelSnapshotAction.java | 3 ++- .../xpack/ml/rest/results/RestGetCategoriesAction.java | 9 ++++++--- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestGetStatusAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestGetStatusAction.java index 77ab9874c11be..4334238fff9b0 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestGetStatusAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestGetStatusAction.java @@ -18,13 +18,13 @@ import static java.util.Collections.singletonList; import static java.util.Collections.singletonMap; -import static org.elasticsearch.rest.RestRequest.Method.POST; +import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestGetStatusAction extends BaseRestHandler { @Override public Map> handledMethodsAndPaths() { - return singletonMap("/_ilm/status", singletonList(POST)); + return singletonMap("/_ilm/status", singletonList(GET)); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestOpenJobAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestOpenJobAction.java index 09f4cdb30c367..ebf94142f887d 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestOpenJobAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestOpenJobAction.java @@ -27,7 +27,7 @@ import java.util.List; import java.util.Map; -import static org.elasticsearch.rest.RestRequest.Method.GET; +import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestOpenJobAction extends BaseRestHandler { @@ -43,8 +43,8 @@ public Map> handledMethodsAndPaths() { public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.singletonList( - new ReplacedRestApi(GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_open", - GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_open", + new ReplacedRestApi(POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_open", + POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_open", deprecationLogger) ); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestRevertModelSnapshotAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestRevertModelSnapshotAction.java index 4f4f03380b623..898423fc4008f 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestRevertModelSnapshotAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestRevertModelSnapshotAction.java @@ -40,7 +40,8 @@ public Map> handledMethodsAndPaths() { public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.singletonList( - new ReplacedRestApi(POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/model_snapshots/{" + + new ReplacedRestApi( + POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/model_snapshots/{" + RevertModelSnapshotAction.Request.SNAPSHOT_ID.getPreferredName() + "}/_revert", POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/model_snapshots/{" + RevertModelSnapshotAction.Request.SNAPSHOT_ID.getPreferredName() + "}/_revert", diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetCategoriesAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetCategoriesAction.java index 7e459e6a337c6..6e7a28c1c7a8a 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetCategoriesAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetCategoriesAction.java @@ -42,7 +42,8 @@ public Map> handledMethodsAndPaths() { public List replacedMethodsAndPaths() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.unmodifiableList(Arrays.asList( - new ReplacedRestApi(GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/categories/{" + new ReplacedRestApi( + GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/categories/{" + Request.CATEGORY_ID.getPreferredName() + "}", GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/categories/{" + Request.CATEGORY_ID.getPreferredName() + "}", @@ -52,10 +53,12 @@ public List replacedMethodsAndPaths() { POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/categories/{" + Request.CATEGORY_ID.getPreferredName() + "}", deprecationLogger), - new ReplacedRestApi(GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/categories", + new ReplacedRestApi( + GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/categories", GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/categories", deprecationLogger), - new ReplacedRestApi(POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/categories", + new ReplacedRestApi( + POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/categories", POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/categories", deprecationLogger) )); From 263e2d2045e10bd7d7621a33c2338dec15fe67ac Mon Sep 17 00:00:00 2001 From: jaymode Date: Wed, 5 Feb 2020 11:44:24 -0700 Subject: [PATCH 03/11] fix inference api --- .../xpack/ml/rest/inference/RestGetTrainedModelsAction.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestGetTrainedModelsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestGetTrainedModelsAction.java index 3922df6ff67ae..e1e593cee11bc 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestGetTrainedModelsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestGetTrainedModelsAction.java @@ -35,7 +35,7 @@ public class RestGetTrainedModelsAction extends BaseRestHandler { public Map> handledMethodsAndPaths() { return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() .put(MachineLearning.BASE_PATH + "inference/{" + TrainedModelConfig.MODEL_ID.getPreferredName() + "}", singletonList(GET)) - .put(MachineLearning.BASE_PATH + MachineLearning.BASE_PATH + "inference", singletonList(GET)) + .put(MachineLearning.BASE_PATH + "inference", singletonList(GET)) .map()); } From 171e36887c80920e02c2f47df87c733dedbe5658 Mon Sep 17 00:00:00 2001 From: jaymode Date: Thu, 6 Feb 2020 14:20:28 -0700 Subject: [PATCH 04/11] refactor to routes --- .../noop/action/bulk/RestNoopBulkAction.java | 15 ++--- .../action/search/RestNoopSearchAction.java | 15 ++--- .../ingest/common/GrokProcessorGetAction.java | 6 +- .../RestMultiSearchTemplateAction.java | 14 ++-- .../RestRenderSearchTemplateAction.java | 15 ++--- .../mustache/RestSearchTemplateAction.java | 14 ++-- .../action/PainlessContextAction.java | 6 +- .../action/PainlessExecuteAction.java | 8 +-- .../index/rankeval/RestRankEvalAction.java | 15 ++--- .../reindex/RestDeleteByQueryAction.java | 6 +- .../index/reindex/RestReindexAction.java | 7 +- .../index/reindex/RestRethrottleAction.java | 18 ++--- .../reindex/RestUpdateByQueryAction.java | 6 +- .../example/resthandler/ExampleCatAction.java | 9 ++- .../RestDieWithDignityAction.java | 7 +- .../http/TestDeprecationHeaderRestAction.java | 9 ++- .../http/TestResponseHeaderRestAction.java | 7 +- .../elasticsearch/rest/BaseRestHandler.java | 4 +- .../elasticsearch/rest/RestController.java | 13 ++-- .../org/elasticsearch/rest/RestHandler.java | 66 +++++++++---------- .../action/RestFieldCapabilitiesAction.java | 15 ++--- .../rest/action/RestMainAction.java | 9 ++- .../RestAddVotingConfigExclusionAction.java | 10 +-- .../admin/cluster/RestCancelTasksAction.java | 15 ++--- .../cluster/RestCleanupRepositoryAction.java | 10 +-- ...RestClearVotingConfigExclusionsAction.java | 10 +-- .../RestClusterAllocationExplainAction.java | 12 ++-- .../cluster/RestClusterGetSettingsAction.java | 10 +-- .../cluster/RestClusterHealthAction.java | 14 ++-- .../cluster/RestClusterRerouteAction.java | 9 +-- .../RestClusterSearchShardsAction.java | 15 ++--- .../admin/cluster/RestClusterStateAction.java | 17 ++--- .../admin/cluster/RestClusterStatsAction.java | 16 ++--- .../RestClusterUpdateSettingsAction.java | 9 +-- .../cluster/RestCreateSnapshotAction.java | 12 ++-- .../cluster/RestDeleteRepositoryAction.java | 10 +-- .../cluster/RestDeleteSnapshotAction.java | 10 +-- .../cluster/RestDeleteStoredScriptAction.java | 10 +-- .../cluster/RestGetRepositoriesAction.java | 16 ++--- .../cluster/RestGetScriptContextAction.java | 7 +- .../cluster/RestGetScriptLanguageAction.java | 7 +- .../admin/cluster/RestGetSnapshotsAction.java | 7 +- .../cluster/RestGetStoredScriptAction.java | 7 +- .../admin/cluster/RestGetTaskAction.java | 7 +- .../admin/cluster/RestListTasksAction.java | 7 +- .../cluster/RestNodesHotThreadsAction.java | 28 ++++---- .../admin/cluster/RestNodesInfoAction.java | 20 +++--- .../admin/cluster/RestNodesStatsAction.java | 22 +++---- .../admin/cluster/RestNodesUsageAction.java | 20 +++--- .../RestPendingClusterTasksAction.java | 7 +- .../cluster/RestPutRepositoryAction.java | 9 ++- .../cluster/RestPutStoredScriptAction.java | 15 ++--- .../RestReloadSecureSettingsAction.java | 16 ++--- .../cluster/RestRemoteClusterInfoAction.java | 7 +- .../cluster/RestRestoreSnapshotAction.java | 7 +- .../cluster/RestSnapshotsStatusAction.java | 18 ++--- .../cluster/RestVerifyRepositoryAction.java | 7 +- .../admin/indices/RestAnalyzeAction.java | 15 ++--- .../indices/RestClearIndicesCacheAction.java | 16 ++--- .../admin/indices/RestCloseIndexAction.java | 16 ++--- .../admin/indices/RestCreateIndexAction.java | 5 +- .../admin/indices/RestDeleteIndexAction.java | 16 ++--- .../RestDeleteIndexTemplateAction.java | 7 +- .../action/admin/indices/RestFlushAction.java | 15 ++--- .../admin/indices/RestForceMergeAction.java | 16 ++--- .../admin/indices/RestGetAliasesAction.java | 23 +++---- .../indices/RestGetFieldMappingAction.java | 15 ++--- .../indices/RestGetIndexTemplateAction.java | 15 ++--- .../admin/indices/RestGetIndicesAction.java | 9 ++- .../admin/indices/RestGetMappingAction.java | 20 +++--- .../admin/indices/RestGetSettingsAction.java | 22 +++---- .../indices/RestIndexDeleteAliasesAction.java | 16 ++--- .../indices/RestIndexPutAliasAction.java | 29 ++++---- .../indices/RestIndicesAliasesAction.java | 7 +- .../indices/RestIndicesSegmentsAction.java | 16 ++--- .../indices/RestIndicesShardStoresAction.java | 16 ++--- .../admin/indices/RestIndicesStatsAction.java | 18 +++-- .../admin/indices/RestOpenIndexAction.java | 16 ++--- .../indices/RestPutIndexTemplateAction.java | 8 +-- .../admin/indices/RestPutMappingAction.java | 14 ++-- .../admin/indices/RestRecoveryAction.java | 16 ++--- .../admin/indices/RestRefreshAction.java | 15 ++--- .../admin/indices/RestResizeHandler.java | 21 +++--- .../indices/RestRolloverIndexAction.java | 16 ++--- .../admin/indices/RestSyncedFlushAction.java | 15 ++--- .../indices/RestUpdateSettingsAction.java | 16 ++--- .../indices/RestUpgradeActionDeprecated.java | 13 ++-- .../RestUpgradeStatusActionDeprecated.java | 13 ++-- .../indices/RestValidateQueryAction.java | 15 ++--- .../rest/action/cat/RestAliasAction.java | 16 ++--- .../rest/action/cat/RestAllocationAction.java | 16 ++--- .../rest/action/cat/RestCatAction.java | 7 +- .../action/cat/RestCatRecoveryAction.java | 16 ++--- .../rest/action/cat/RestCountAction.java | 16 ++--- .../rest/action/cat/RestFielddataAction.java | 16 ++--- .../rest/action/cat/RestHealthAction.java | 7 +- .../rest/action/cat/RestIndicesAction.java | 17 ++--- .../rest/action/cat/RestMasterAction.java | 7 +- .../rest/action/cat/RestNodeAttrsAction.java | 6 +- .../rest/action/cat/RestNodesAction.java | 7 +- .../cat/RestPendingClusterTasksAction.java | 7 +- .../rest/action/cat/RestPluginsAction.java | 7 +- .../action/cat/RestRepositoriesAction.java | 7 +- .../rest/action/cat/RestSegmentsAction.java | 15 ++--- .../rest/action/cat/RestShardsAction.java | 15 ++--- .../rest/action/cat/RestSnapshotAction.java | 15 ++--- .../rest/action/cat/RestTasksAction.java | 7 +- .../rest/action/cat/RestTemplatesAction.java | 16 ++--- .../rest/action/cat/RestThreadPoolAction.java | 14 ++-- .../rest/action/document/RestBulkAction.java | 15 ++--- .../action/document/RestDeleteAction.java | 7 +- .../rest/action/document/RestGetAction.java | 12 ++-- .../action/document/RestGetSourceAction.java | 9 ++- .../rest/action/document/RestIndexAction.java | 19 +++--- .../action/document/RestMultiGetAction.java | 15 ++--- .../document/RestMultiTermVectorsAction.java | 15 ++--- .../document/RestTermVectorsAction.java | 15 ++--- .../action/document/RestUpdateAction.java | 7 +- .../ingest/RestDeletePipelineAction.java | 7 +- .../action/ingest/RestGetPipelineAction.java | 16 ++--- .../action/ingest/RestPutPipelineAction.java | 7 +- .../ingest/RestSimulatePipelineAction.java | 15 ++--- .../action/search/RestClearScrollAction.java | 19 ++---- .../rest/action/search/RestCountAction.java | 15 ++--- .../rest/action/search/RestExplainAction.java | 9 ++- .../action/search/RestMultiSearchAction.java | 14 ++-- .../rest/action/search/RestSearchAction.java | 14 ++-- .../action/search/RestSearchScrollAction.java | 14 ++-- .../action/ActionModuleTests.java | 14 ++-- .../rest/BaseRestHandlerTests.java | 38 +++++------ .../usage/UsageServiceTests.java | 5 +- .../xpack/ccr/rest/RestCcrStatsAction.java | 7 +- .../RestDeleteAutoFollowPatternAction.java | 7 +- .../xpack/ccr/rest/RestFollowInfoAction.java | 7 +- .../xpack/ccr/rest/RestFollowStatsAction.java | 7 +- .../ccr/rest/RestForgetFollowerAction.java | 7 +- .../rest/RestGetAutoFollowPatternAction.java | 16 ++--- .../RestPauseAutoFollowPatternAction.java | 7 +- .../xpack/ccr/rest/RestPauseFollowAction.java | 7 +- .../rest/RestPutAutoFollowPatternAction.java | 7 +- .../xpack/ccr/rest/RestPutFollowAction.java | 7 +- .../RestResumeAutoFollowPatternAction.java | 7 +- .../ccr/rest/RestResumeFollowAction.java | 7 +- .../xpack/ccr/rest/RestUnfollowAction.java | 7 +- .../license/RestDeleteLicenseAction.java | 7 +- .../license/RestGetBasicStatus.java | 7 +- .../license/RestGetLicenseAction.java | 6 +- .../license/RestGetTrialStatus.java | 7 +- .../license/RestPostStartBasicLicense.java | 7 +- .../license/RestPostStartTrialLicense.java | 6 +- .../license/RestPutLicenseAction.java | 9 ++- .../action/RestReloadAnalyzersAction.java | 9 ++- .../core/rest/action/RestXPackInfoAction.java | 9 ++- .../rest/action/RestXPackUsageAction.java | 7 +- .../rest/RestGetCertificateInfoAction.java | 7 +- .../RestDeprecationInfoAction.java | 16 ++--- .../rest/RestDeleteEnrichPolicyAction.java | 7 +- .../enrich/rest/RestEnrichStatsAction.java | 7 +- .../rest/RestExecuteEnrichPolicyAction.java | 9 ++- .../rest/RestGetEnrichPolicyAction.java | 16 ++--- .../rest/RestPutEnrichPolicyAction.java | 7 +- .../xpack/eql/plugin/RestEqlSearchAction.java | 9 ++- .../rest/action/RestFreezeIndexAction.java | 16 ++--- .../graph/rest/action/RestGraphAction.java | 8 +-- .../ilm/action/RestDeleteLifecycleAction.java | 7 +- .../action/RestExplainLifecycleAction.java | 7 +- .../ilm/action/RestGetLifecycleAction.java | 16 ++--- .../xpack/ilm/action/RestGetStatusAction.java | 7 +- .../ilm/action/RestMoveToStepAction.java | 7 +- .../ilm/action/RestPutLifecycleAction.java | 7 +- .../RestRemoveIndexLifecyclePolicyAction.java | 7 +- .../xpack/ilm/action/RestRetryAction.java | 7 +- .../xpack/ilm/action/RestStartILMAction.java | 7 +- .../xpack/ilm/action/RestStopAction.java | 7 +- .../RestDeleteSnapshotLifecycleAction.java | 7 +- .../RestExecuteSnapshotLifecycleAction.java | 9 ++- .../RestExecuteSnapshotRetentionAction.java | 7 +- .../slm/action/RestGetSLMStatusAction.java | 7 +- .../RestGetSnapshotLifecycleAction.java | 16 ++--- .../RestGetSnapshotLifecycleStatsAction.java | 7 +- .../RestPutSnapshotLifecycleAction.java | 7 +- .../xpack/slm/action/RestStartSLMAction.java | 7 +- .../xpack/slm/action/RestStopSLMAction.java | 7 +- .../ml/rest/RestDeleteExpiredDataAction.java | 10 ++- .../ml/rest/RestFindFileStructureAction.java | 10 ++- .../xpack/ml/rest/RestMlInfoAction.java | 10 ++- .../ml/rest/RestSetUpgradeModeAction.java | 10 ++- .../calendar/RestDeleteCalendarAction.java | 10 ++- .../RestDeleteCalendarEventAction.java | 10 ++- .../calendar/RestDeleteCalendarJobAction.java | 10 ++- .../calendar/RestGetCalendarEventsAction.java | 10 ++- .../rest/calendar/RestGetCalendarsAction.java | 16 ++--- .../calendar/RestPostCalendarEventAction.java | 10 ++- .../rest/calendar/RestPutCalendarAction.java | 10 ++- .../calendar/RestPutCalendarJobAction.java | 10 ++- .../ml/rest/cat/RestCatDatafeedsAction.java | 16 ++--- .../xpack/ml/rest/cat/RestCatJobsAction.java | 16 ++--- .../rest/cat/RestCatTrainedModelsAction.java | 16 ++--- .../datafeeds/RestDeleteDatafeedAction.java | 10 ++- .../datafeeds/RestGetDatafeedStatsAction.java | 12 ++-- .../datafeeds/RestGetDatafeedsAction.java | 12 ++-- .../datafeeds/RestPreviewDatafeedAction.java | 10 ++- .../rest/datafeeds/RestPutDatafeedAction.java | 10 ++- .../datafeeds/RestStartDatafeedAction.java | 10 ++- .../datafeeds/RestStopDatafeedAction.java | 10 ++- .../datafeeds/RestUpdateDatafeedAction.java | 10 ++- .../RestDeleteDataFrameAnalyticsAction.java | 10 +-- .../RestEvaluateDataFrameAction.java | 7 +- .../RestExplainDataFrameAnalyticsAction.java | 18 +++-- .../RestGetDataFrameAnalyticsAction.java | 17 ++--- .../RestGetDataFrameAnalyticsStatsAction.java | 18 ++--- .../RestPutDataFrameAnalyticsAction.java | 9 +-- .../RestStartDataFrameAnalyticsAction.java | 11 ++-- .../RestStopDataFrameAnalyticsAction.java | 11 ++-- .../rest/filter/RestDeleteFilterAction.java | 10 ++- .../ml/rest/filter/RestGetFiltersAction.java | 12 ++-- .../ml/rest/filter/RestPutFilterAction.java | 10 ++- .../rest/filter/RestUpdateFilterAction.java | 10 ++- .../RestDeleteTrainedModelAction.java | 9 +-- .../inference/RestGetTrainedModelsAction.java | 18 ++--- .../RestGetTrainedModelsStatsAction.java | 17 ++--- .../inference/RestPutTrainedModelAction.java | 9 +-- .../xpack/ml/rest/job/RestCloseJobAction.java | 10 ++- .../ml/rest/job/RestDeleteForecastAction.java | 13 ++-- .../ml/rest/job/RestDeleteJobAction.java | 10 ++- .../xpack/ml/rest/job/RestFlushJobAction.java | 10 ++- .../ml/rest/job/RestForecastJobAction.java | 10 ++- .../ml/rest/job/RestGetJobStatsAction.java | 12 ++-- .../xpack/ml/rest/job/RestGetJobsAction.java | 12 ++-- .../xpack/ml/rest/job/RestOpenJobAction.java | 10 ++- .../xpack/ml/rest/job/RestPostDataAction.java | 10 ++- .../ml/rest/job/RestPostJobUpdateAction.java | 10 ++- .../xpack/ml/rest/job/RestPutJobAction.java | 10 ++- .../RestDeleteModelSnapshotAction.java | 10 ++- .../RestGetModelSnapshotsAction.java | 16 ++--- .../RestRevertModelSnapshotAction.java | 10 ++- .../RestUpdateModelSnapshotAction.java | 10 ++- .../ml/rest/results/RestGetBucketsAction.java | 16 ++--- .../rest/results/RestGetCategoriesAction.java | 16 ++--- .../results/RestGetInfluencersAction.java | 12 ++-- .../results/RestGetOverallBucketsAction.java | 12 ++-- .../ml/rest/results/RestGetRecordsAction.java | 12 ++-- .../validate/RestValidateDetectorAction.java | 10 ++- .../validate/RestValidateJobConfigAction.java | 10 ++- .../rest/action/RestMonitoringBulkAction.java | 8 +-- .../rest/RestDeleteRollupJobAction.java | 7 +- .../rollup/rest/RestGetRollupCapsAction.java | 7 +- .../rest/RestGetRollupIndexCapsAction.java | 7 +- .../rollup/rest/RestGetRollupJobsAction.java | 7 +- .../rollup/rest/RestPutRollupJobAction.java | 7 +- .../rollup/rest/RestRollupSearchAction.java | 15 ++--- .../rollup/rest/RestStartRollupJobAction.java | 7 +- .../rollup/rest/RestStopRollupJobAction.java | 7 +- .../security/rest/SecurityRestFilter.java | 13 ++-- .../rest/action/RestAuthenticateAction.java | 10 ++- .../RestDelegatePkiAuthenticationAction.java | 7 +- .../action/apikey/RestCreateApiKeyAction.java | 9 ++- .../action/apikey/RestGetApiKeyAction.java | 7 +- .../apikey/RestInvalidateApiKeyAction.java | 7 +- .../action/oauth2/RestGetTokenAction.java | 10 ++- .../oauth2/RestInvalidateTokenAction.java | 10 ++- .../RestOpenIdConnectAuthenticateAction.java | 7 +- .../oidc/RestOpenIdConnectLogoutAction.java | 7 +- ...nIdConnectPrepareAuthenticationAction.java | 7 +- .../privilege/RestDeletePrivilegesAction.java | 10 ++- .../RestGetBuiltinPrivilegesAction.java | 7 +- .../privilege/RestGetPrivilegesAction.java | 13 ++-- .../privilege/RestPutPrivilegesAction.java | 11 ++-- .../realm/RestClearRealmCacheAction.java | 10 ++- .../role/RestClearRolesCacheAction.java | 10 ++- .../action/role/RestDeleteRoleAction.java | 10 ++- .../rest/action/role/RestGetRolesAction.java | 12 ++-- .../rest/action/role/RestPutRoleAction.java | 12 ++-- .../RestDeleteRoleMappingAction.java | 10 ++- .../RestGetRoleMappingsAction.java | 12 ++-- .../rolemapping/RestPutRoleMappingAction.java | 12 ++-- .../saml/RestSamlAuthenticateAction.java | 10 ++- .../saml/RestSamlInvalidateSessionAction.java | 10 ++- .../action/saml/RestSamlLogoutAction.java | 10 ++- .../RestSamlPrepareAuthenticationAction.java | 10 ++- .../action/user/RestChangePasswordAction.java | 16 ++--- .../action/user/RestDeleteUserAction.java | 10 ++- .../user/RestGetUserPrivilegesAction.java | 10 ++- .../rest/action/user/RestGetUsersAction.java | 12 ++-- .../action/user/RestHasPrivilegesAction.java | 16 ++--- .../rest/action/user/RestPutUserAction.java | 12 ++-- .../action/user/RestSetEnabledAction.java | 16 ++--- .../action/SecurityBaseRestHandlerTests.java | 6 +- .../action/saml/SamlBaseRestHandlerTests.java | 6 +- .../sql/plugin/RestSqlClearCursorAction.java | 7 +- .../xpack/sql/plugin/RestSqlQueryAction.java | 9 ++- .../xpack/sql/plugin/RestSqlStatsAction.java | 7 +- .../sql/plugin/RestSqlTranslateAction.java | 9 ++- .../action/RestDeleteTransformAction.java | 7 +- .../rest/action/RestGetTransformAction.java | 16 ++--- .../action/RestGetTransformStatsAction.java | 16 ++--- .../action/RestPreviewTransformAction.java | 7 +- .../rest/action/RestPutTransformAction.java | 7 +- .../rest/action/RestStartTransformAction.java | 7 +- .../rest/action/RestStopTransformAction.java | 7 +- .../action/RestUpdateTransformAction.java | 7 +- .../RestDeleteTransformActionDeprecated.java | 12 ++-- .../RestGetTransformActionDeprecated.java | 13 ++-- ...RestGetTransformStatsActionDeprecated.java | 13 ++-- .../RestPreviewTransformActionDeprecated.java | 12 ++-- .../RestPutTransformActionDeprecated.java | 10 ++- .../RestStartTransformActionDeprecated.java | 12 ++-- .../RestStopTransformActionDeprecated.java | 10 ++- .../RestUpdateTransformActionDeprecated.java | 12 ++-- .../rest/action/RestAckWatchAction.java | 15 ++--- .../rest/action/RestActivateWatchAction.java | 15 +++-- .../rest/action/RestDeleteWatchAction.java | 7 +- .../rest/action/RestExecuteWatchAction.java | 14 ++-- .../rest/action/RestGetWatchAction.java | 7 +- .../rest/action/RestPutWatchAction.java | 9 ++- .../rest/action/RestWatchServiceAction.java | 11 ++-- .../rest/action/RestWatcherStatsAction.java | 15 ++--- 317 files changed, 1365 insertions(+), 2233 deletions(-) diff --git a/client/client-benchmark-noop-api-plugin/src/main/java/org/elasticsearch/plugin/noop/action/bulk/RestNoopBulkAction.java b/client/client-benchmark-noop-api-plugin/src/main/java/org/elasticsearch/plugin/noop/action/bulk/RestNoopBulkAction.java index d6c0ef736e344..6333c7391f60e 100644 --- a/client/client-benchmark-noop-api-plugin/src/main/java/org/elasticsearch/plugin/noop/action/bulk/RestNoopBulkAction.java +++ b/client/client-benchmark-noop-api-plugin/src/main/java/org/elasticsearch/plugin/noop/action/bulk/RestNoopBulkAction.java @@ -27,21 +27,17 @@ import org.elasticsearch.action.update.UpdateResponse; import org.elasticsearch.client.Requests; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.index.shard.ShardId; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestBuilderListener; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; import static java.util.Arrays.asList; import static java.util.Collections.unmodifiableList; @@ -52,11 +48,12 @@ public class RestNoopBulkAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_noop_bulk", unmodifiableList(asList(POST, PUT))) - .put("/{index}/_noop_bulk", unmodifiableList(asList(POST, PUT))) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_noop_bulk", POST), + new Route("/_noop_bulk", PUT), + new Route("/{index}/_noop_bulk", POST), + new Route("/{index}/_noop_bulk", PUT))); } @Override diff --git a/client/client-benchmark-noop-api-plugin/src/main/java/org/elasticsearch/plugin/noop/action/search/RestNoopSearchAction.java b/client/client-benchmark-noop-api-plugin/src/main/java/org/elasticsearch/plugin/noop/action/search/RestNoopSearchAction.java index 1ea392434e6f2..15cb525d49a66 100644 --- a/client/client-benchmark-noop-api-plugin/src/main/java/org/elasticsearch/plugin/noop/action/search/RestNoopSearchAction.java +++ b/client/client-benchmark-noop-api-plugin/src/main/java/org/elasticsearch/plugin/noop/action/search/RestNoopSearchAction.java @@ -20,15 +20,11 @@ import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestStatusToXContentListener; -import java.util.Collections; import java.util.List; -import java.util.Map; import static java.util.Arrays.asList; import static java.util.Collections.unmodifiableList; @@ -38,11 +34,12 @@ public class RestNoopSearchAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_noop_search", unmodifiableList(asList(GET, POST))) - .put("/{index}/_noop_search", unmodifiableList(asList(GET, POST))) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_noop_search", GET), + new Route("/_noop_search", POST), + new Route("/{index}/_noop_search", GET), + new Route("/{index}/_noop_search", POST))); } @Override diff --git a/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/GrokProcessorGetAction.java b/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/GrokProcessorGetAction.java index 534eac6a50974..1e212b007bbb5 100644 --- a/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/GrokProcessorGetAction.java +++ b/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/GrokProcessorGetAction.java @@ -33,7 +33,6 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.tasks.Task; import org.elasticsearch.transport.TransportService; @@ -43,7 +42,6 @@ import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.ingest.common.IngestCommonPlugin.GROK_PATTERNS; import static org.elasticsearch.rest.RestRequest.Method.GET; @@ -121,8 +119,8 @@ protected void doExecute(Task task, Request request, ActionListener li public static class RestAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_ingest/processor/grok", singletonList(GET)); + public List handledRoutes() { + return singletonList(new Route("/_ingest/processor/grok", GET)); } @Override diff --git a/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestMultiSearchTemplateAction.java b/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestMultiSearchTemplateAction.java index 37413b0314dad..6669132395b86 100644 --- a/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestMultiSearchTemplateAction.java +++ b/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestMultiSearchTemplateAction.java @@ -20,11 +20,9 @@ package org.elasticsearch.script.mustache; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.rest.action.search.RestMultiSearchAction; import org.elasticsearch.rest.action.search.RestSearchAction; @@ -33,7 +31,6 @@ import java.util.Collections; import java.util.HashSet; import java.util.List; -import java.util.Map; import java.util.Set; import static java.util.Arrays.asList; @@ -60,11 +57,12 @@ public RestMultiSearchTemplateAction(Settings settings) { } @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_msearch/template", unmodifiableList(asList(GET, POST))) - .put("/{index}/_msearch/template", unmodifiableList(asList(GET, POST))) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_msearch/template", GET), + new Route("/_msearch/template", POST), + new Route("/{index}/_msearch/template", GET), + new Route("/{index}/_msearch/template", POST))); } @Override diff --git a/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestRenderSearchTemplateAction.java b/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestRenderSearchTemplateAction.java index 5327d0dc125a7..2a78684daede6 100644 --- a/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestRenderSearchTemplateAction.java +++ b/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestRenderSearchTemplateAction.java @@ -20,18 +20,14 @@ package org.elasticsearch.script.mustache; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.script.ScriptType; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; import static java.util.Arrays.asList; import static java.util.Collections.unmodifiableList; @@ -41,11 +37,12 @@ public class RestRenderSearchTemplateAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_render/template", unmodifiableList(asList(GET, POST))) - .put("/_render/template/{id}", unmodifiableList(asList(GET, POST))) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_render/template", GET), + new Route("/_render/template", POST), + new Route("/_render/template/{id}", GET), + new Route("/_render/template/{id}", POST))); } @Override diff --git a/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestSearchTemplateAction.java b/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestSearchTemplateAction.java index aaa9cedddf3cf..ea8f54a2b7ca4 100644 --- a/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestSearchTemplateAction.java +++ b/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestSearchTemplateAction.java @@ -21,11 +21,9 @@ import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestStatusToXContentListener; import org.elasticsearch.rest.action.search.RestSearchAction; @@ -34,7 +32,6 @@ import java.util.Collections; import java.util.HashSet; import java.util.List; -import java.util.Map; import java.util.Set; import static java.util.Arrays.asList; @@ -52,11 +49,12 @@ public class RestSearchTemplateAction extends BaseRestHandler { } @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_search/template", unmodifiableList(asList(GET, POST))) - .put("/{index}/_search/template", unmodifiableList(asList(GET, POST))) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_search/template", GET), + new Route("/_search/template", POST), + new Route("/{index}/_search/template", GET), + new Route("/{index}/_search/template", POST))); } @Override diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/action/PainlessContextAction.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/action/PainlessContextAction.java index 1d35eb608056c..7e77f484fe102 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/action/PainlessContextAction.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/action/PainlessContextAction.java @@ -38,7 +38,6 @@ import org.elasticsearch.painless.lookup.PainlessLookup; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.script.ScriptContext; import org.elasticsearch.tasks.Task; @@ -53,7 +52,6 @@ import java.util.stream.Collectors; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; /** @@ -197,8 +195,8 @@ protected void doExecute(Task task, Request request, ActionListener li public static class RestAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_scripts/painless/_context", singletonList(GET)); + public List handledRoutes() { + return singletonList(new Route("/_scripts/painless/_context", GET)); } @Override diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/action/PainlessExecuteAction.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/action/PainlessExecuteAction.java index 7ecce92a6d3a2..bf6cbee1cd7bb 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/action/PainlessExecuteAction.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/action/PainlessExecuteAction.java @@ -69,7 +69,6 @@ import org.elasticsearch.indices.IndicesService; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.script.FilterScript; import org.elasticsearch.script.ScoreScript; @@ -86,7 +85,6 @@ import java.util.Objects; import static java.util.Arrays.asList; -import static java.util.Collections.singletonMap; import static java.util.Collections.unmodifiableList; import static org.elasticsearch.action.ValidateActions.addValidationError; import static org.elasticsearch.rest.RestRequest.Method.GET; @@ -569,8 +567,10 @@ private static Response prepareRamIndex(Request request, public static class RestAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_scripts/painless/_execute", unmodifiableList(asList(GET, POST))); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_scripts/painless/_execute", GET), + new Route("/_scripts/painless/_execute", POST))); } @Override diff --git a/modules/rank-eval/src/main/java/org/elasticsearch/index/rankeval/RestRankEvalAction.java b/modules/rank-eval/src/main/java/org/elasticsearch/index/rankeval/RestRankEvalAction.java index 773bbef1cef53..452425303a25e 100644 --- a/modules/rank-eval/src/main/java/org/elasticsearch/index/rankeval/RestRankEvalAction.java +++ b/modules/rank-eval/src/main/java/org/elasticsearch/index/rankeval/RestRankEvalAction.java @@ -23,17 +23,13 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; import static java.util.Arrays.asList; import static java.util.Collections.unmodifiableList; @@ -97,11 +93,12 @@ public class RestRankEvalAction extends BaseRestHandler { public static String ENDPOINT = "_rank_eval"; @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/" + ENDPOINT, unmodifiableList(asList(GET, POST))) - .put("/{index}/" + ENDPOINT, unmodifiableList(asList(GET, POST))) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/" + ENDPOINT, GET), + new Route("/" + ENDPOINT, POST), + new Route("/{index}/" + ENDPOINT, GET), + new Route("/{index}/" + ENDPOINT, POST))); } @Override diff --git a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestDeleteByQueryAction.java b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestDeleteByQueryAction.java index 3cb0f08aeac1b..162fcc4ae72f5 100644 --- a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestDeleteByQueryAction.java +++ b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestDeleteByQueryAction.java @@ -21,7 +21,6 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import java.io.IOException; import java.util.HashMap; @@ -30,7 +29,6 @@ import java.util.function.Consumer; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestDeleteByQueryAction extends AbstractBulkByQueryRestHandler { @@ -40,8 +38,8 @@ public RestDeleteByQueryAction() { } @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/{index}/_delete_by_query", singletonList(POST)); + public List handledRoutes() { + return singletonList(new Route("/{index}/_delete_by_query", POST)); } @Override diff --git a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestReindexAction.java b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestReindexAction.java index 808f4844b3177..e84034ee25d19 100644 --- a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestReindexAction.java +++ b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestReindexAction.java @@ -22,14 +22,11 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.common.unit.TimeValue.parseTimeValue; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -43,8 +40,8 @@ public RestReindexAction() { } @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_reindex", singletonList(POST)); + public List handledRoutes() { + return singletonList(new Route("/_reindex", POST)); } @Override diff --git a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestRethrottleAction.java b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestRethrottleAction.java index 78143d6ad2cd9..40d9d1edadcad 100644 --- a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestRethrottleAction.java +++ b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestRethrottleAction.java @@ -21,18 +21,15 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.cluster.node.DiscoveryNodes; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.tasks.TaskId; -import java.util.Collections; import java.util.List; -import java.util.Map; import java.util.function.Supplier; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.action.admin.cluster.RestListTasksAction.listTasksResponseListener; @@ -44,12 +41,11 @@ public RestRethrottleAction(Supplier nodesInCluster) { } @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_update_by_query/{taskId}/_rethrottle", singletonList(POST)) - .put("/_delete_by_query/{taskId}/_rethrottle", singletonList(POST)) - .put("/_reindex/{taskId}/_rethrottle", singletonList(POST)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_update_by_query/{taskId}/_rethrottle", POST), + new Route("/_delete_by_query/{taskId}/_rethrottle", POST), + new Route("/_reindex/{taskId}/_rethrottle", POST))); } @Override diff --git a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestUpdateByQueryAction.java b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestUpdateByQueryAction.java index 47799b036da0d..42423cbfb8b46 100644 --- a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestUpdateByQueryAction.java +++ b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestUpdateByQueryAction.java @@ -23,7 +23,6 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.xcontent.LoggingDeprecationHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.script.Script; import org.elasticsearch.script.ScriptType; @@ -36,7 +35,6 @@ import java.util.function.Consumer; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.script.Script.DEFAULT_SCRIPT_LANG; @@ -47,8 +45,8 @@ public RestUpdateByQueryAction() { } @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/{index}/_update_by_query", singletonList(POST)); + public List handledRoutes() { + return singletonList(new Route("/{index}/_update_by_query", POST)); } @Override diff --git a/plugins/examples/rest-handler/src/main/java/org/elasticsearch/example/resthandler/ExampleCatAction.java b/plugins/examples/rest-handler/src/main/java/org/elasticsearch/example/resthandler/ExampleCatAction.java index f5cb99839b51b..b29abf73f8a3c 100644 --- a/plugins/examples/rest-handler/src/main/java/org/elasticsearch/example/resthandler/ExampleCatAction.java +++ b/plugins/examples/rest-handler/src/main/java/org/elasticsearch/example/resthandler/ExampleCatAction.java @@ -22,15 +22,12 @@ import org.elasticsearch.common.Table; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.cat.AbstractCatAction; import org.elasticsearch.rest.action.cat.RestTable; import java.util.List; -import java.util.Map; import static java.util.Arrays.asList; -import static java.util.Collections.singletonMap; import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -41,8 +38,10 @@ public class ExampleCatAction extends AbstractCatAction { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_cat/example", unmodifiableList(asList(GET, POST))); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_cat/example", GET), + new Route("/_cat/example", POST))); } @Override diff --git a/qa/die-with-dignity/src/main/java/org/elasticsearch/RestDieWithDignityAction.java b/qa/die-with-dignity/src/main/java/org/elasticsearch/RestDieWithDignityAction.java index 04b800265be7c..df370ccb55fc7 100644 --- a/qa/die-with-dignity/src/main/java/org/elasticsearch/RestDieWithDignityAction.java +++ b/qa/die-with-dignity/src/main/java/org/elasticsearch/RestDieWithDignityAction.java @@ -22,13 +22,10 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestDieWithDignityAction extends BaseRestHandler { @@ -36,8 +33,8 @@ public class RestDieWithDignityAction extends BaseRestHandler { RestDieWithDignityAction() {} @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_die_with_dignity", singletonList(GET)); + public List handledRoutes() { + return singletonList(new Route("/_die_with_dignity", GET)); } @Override diff --git a/qa/smoke-test-http/src/test/java/org/elasticsearch/http/TestDeprecationHeaderRestAction.java b/qa/smoke-test-http/src/test/java/org/elasticsearch/http/TestDeprecationHeaderRestAction.java index 55b1e398df032..c0010f00ec354 100644 --- a/qa/smoke-test-http/src/test/java/org/elasticsearch/http/TestDeprecationHeaderRestAction.java +++ b/qa/smoke-test-http/src/test/java/org/elasticsearch/http/TestDeprecationHeaderRestAction.java @@ -29,7 +29,6 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestStatus; import java.io.IOException; @@ -75,9 +74,9 @@ public TestDeprecationHeaderRestAction(Settings settings) { } @Override - public List deprecatedHandledMethodsAndPaths() { + public List deprecatedRoutes() { return singletonList( - new DeprecatedRestApi("/_test_cluster/deprecated_settings", singletonList(GET), DEPRECATED_ENDPOINT, deprecationLogger)); + new DeprecatedRoute("/_test_cluster/deprecated_settings", GET, DEPRECATED_ENDPOINT, deprecationLogger)); } @Override @@ -86,8 +85,8 @@ public String getName() { } @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @SuppressWarnings("unchecked") // List casts diff --git a/qa/smoke-test-http/src/test/java/org/elasticsearch/http/TestResponseHeaderRestAction.java b/qa/smoke-test-http/src/test/java/org/elasticsearch/http/TestResponseHeaderRestAction.java index 73bc20181498a..752316b6b23c5 100644 --- a/qa/smoke-test-http/src/test/java/org/elasticsearch/http/TestResponseHeaderRestAction.java +++ b/qa/smoke-test-http/src/test/java/org/elasticsearch/http/TestResponseHeaderRestAction.java @@ -22,22 +22,19 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; public class TestResponseHeaderRestAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_protected", singletonList(GET)); + public List handledRoutes() { + return singletonList(new Route("/_protected", GET)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/BaseRestHandler.java b/server/src/main/java/org/elasticsearch/rest/BaseRestHandler.java index 26ba8aa27fb1a..9eb0b98508852 100644 --- a/server/src/main/java/org/elasticsearch/rest/BaseRestHandler.java +++ b/server/src/main/java/org/elasticsearch/rest/BaseRestHandler.java @@ -27,7 +27,6 @@ import org.elasticsearch.common.settings.Setting; import org.elasticsearch.common.settings.Setting.Property; import org.elasticsearch.plugins.ActionPlugin; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.admin.cluster.RestNodesUsageAction; import java.io.IOException; @@ -36,7 +35,6 @@ import java.util.HashSet; import java.util.List; import java.util.Locale; -import java.util.Map; import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; @@ -74,7 +72,7 @@ public final long getUsageCount() { * {@inheritDoc} */ @Override - public abstract Map> handledMethodsAndPaths(); + public abstract List handledRoutes(); @Override public final void handleRequest(RestRequest request, RestChannel channel, NodeClient client) throws Exception { diff --git a/server/src/main/java/org/elasticsearch/rest/RestController.java b/server/src/main/java/org/elasticsearch/rest/RestController.java index 239f89c5c2028..4c9298dc52d69 100644 --- a/server/src/main/java/org/elasticsearch/rest/RestController.java +++ b/server/src/main/java/org/elasticsearch/rest/RestController.java @@ -159,13 +159,12 @@ protected void registerHandler(RestRequest.Method method, String path, RestHandl * Registers a REST handler with the controller. The REST handler declares the {@code method} * and {@code path} combinations. */ - public void registerHandler(RestHandler restHandler) { - restHandler.handledMethodsAndPaths().forEach((path, methods) -> - methods.forEach(method -> registerHandler(method, path, restHandler))); - restHandler.deprecatedHandledMethodsAndPaths().forEach(api -> api.getMethods().forEach(method -> - registerAsDeprecatedHandler(method, api.getPath(), restHandler, api.getDeprecationMessage(), api.getLogger()))); - restHandler.replacedMethodsAndPaths().forEach(api -> registerWithDeprecatedHandler(api.getMethod(), api.getPath(), restHandler, - api.getDeprecatedMethod(), api.getDeprecatedPath(), api.getLogger())); + public void registerHandler(final RestHandler restHandler) { + restHandler.handledRoutes().forEach(route -> registerHandler(route.getMethod(), route.getPath(), restHandler)); + restHandler.deprecatedRoutes().forEach(route -> + registerAsDeprecatedHandler(route.getMethod(), route.getPath(), restHandler, route.getDeprecationMessage(), route.getLogger())); + restHandler.replacedRoutes().forEach(route -> registerWithDeprecatedHandler(route.getMethod(), route.getPath(), + restHandler, route.getDeprecatedMethod(), route.getDeprecatedPath(), route.getLogger())); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/RestHandler.java b/server/src/main/java/org/elasticsearch/rest/RestHandler.java index 5f0862ed80e27..f532602c253a0 100644 --- a/server/src/main/java/org/elasticsearch/rest/RestHandler.java +++ b/server/src/main/java/org/elasticsearch/rest/RestHandler.java @@ -26,7 +26,6 @@ import java.util.Collections; import java.util.List; -import java.util.Map; /** * Handler for REST requests @@ -67,18 +66,18 @@ default boolean allowsUnsafeBuffers() { } /** - * The map of {@code path} to {@code methods} that this RestHandler is responsible for handling. + * The list of {@link Route}s that this RestHandler is responsible for handling. */ - default Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + default List handledRoutes() { + return Collections.emptyList(); } /** * A list of APIs handled by this RestHandler that are deprecated and do not have a direct * replacement. If changing the {@code path} or {@code method} of the API, - * use {@link #replacedMethodsAndPaths()}. + * use {@link #replacedRoutes()}. */ - default List deprecatedHandledMethodsAndPaths() { + default List deprecatedRoutes() { return Collections.emptyList(); } @@ -87,39 +86,47 @@ default List deprecatedHandledMethodsAndPaths() { * {@code method} changed. The pre-existing {@code path} and {@code method} will be registered * as deprecated alongside the updated {@code path} and {@code method}. */ - default List replacedMethodsAndPaths() { + default List replacedRoutes() { return Collections.emptyList(); } + class Route { + + private final String path; + private final Method method; + + public Route(String path, Method method) { + this.path = path; + this.method = method; + } + + public String getPath() { + return path; + } + + public Method getMethod() { + return method; + } + } + /** * Represents an API that has been deprecated and is slated for removal. */ - class DeprecatedRestApi { + class DeprecatedRoute extends Route { - private final String path; private final String deprecationMessage; - private final List methods; private final DeprecationLogger logger; - public DeprecatedRestApi(String path, List methods, String deprecationMessage, DeprecationLogger logger) { - this.path = path; - this.methods = methods; + public DeprecatedRoute(String path, Method method, String deprecationMessage, DeprecationLogger logger) { + super(path, method); this.deprecationMessage = deprecationMessage; this.logger = logger; } - public String getPath() { - return path; - } - public String getDeprecationMessage() { return deprecationMessage; } - public List getMethods() { - return methods; - } - public DeprecationLogger getLogger() { return logger; } @@ -129,34 +136,23 @@ public DeprecationLogger getLogger() { * Represents an API that has had its {@code path} or {@code method} changed. Holds both the * new and previous {@code path} and {@code method} combination. */ - class ReplacedRestApi { + class ReplacedRoute extends Route { - private final String path; private final String deprecatedPath; - private final Method method; private final Method deprecatedMethod; private final DeprecationLogger logger; - public ReplacedRestApi(Method method, String path, Method deprecatedMethod, String deprecatedPath, DeprecationLogger logger) { - this.method = method; - this.path = path; + public ReplacedRoute(Method method, String path, Method deprecatedMethod, String deprecatedPath, DeprecationLogger logger) { + super(path, method); this.deprecatedMethod = deprecatedMethod; this.deprecatedPath = deprecatedPath; this.logger = logger; } - public String getPath() { - return path; - } - public String getDeprecatedPath() { return deprecatedPath; } - public Method getMethod() { - return method; - } - public Method getDeprecatedMethod() { return deprecatedMethod; } diff --git a/server/src/main/java/org/elasticsearch/rest/action/RestFieldCapabilitiesAction.java b/server/src/main/java/org/elasticsearch/rest/action/RestFieldCapabilitiesAction.java index 3b03b406c640e..eb83a7c6de7a5 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/RestFieldCapabilitiesAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/RestFieldCapabilitiesAction.java @@ -23,15 +23,11 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; import static java.util.Arrays.asList; import static java.util.Collections.unmodifiableList; @@ -41,11 +37,12 @@ public class RestFieldCapabilitiesAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_field_caps", unmodifiableList(asList(GET, POST))) - .put("/{index}/_field_caps", unmodifiableList(asList(GET, POST))) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_field_caps", GET), + new Route("/_field_caps", POST), + new Route("/{index}/_field_caps", GET), + new Route("/{index}/_field_caps", POST))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/RestMainAction.java b/server/src/main/java/org/elasticsearch/rest/action/RestMainAction.java index 2dbdd895012d2..da86dfef1982f 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/RestMainAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/RestMainAction.java @@ -27,16 +27,13 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Arrays.asList; -import static java.util.Collections.singletonMap; import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.HEAD; @@ -44,8 +41,10 @@ public class RestMainAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/", unmodifiableList(asList(GET, HEAD))); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/", GET), + new Route("/", HEAD))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestAddVotingConfigExclusionAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestAddVotingConfigExclusionAction.java index 7a78e5789a676..bea4dbfb1f21a 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestAddVotingConfigExclusionAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestAddVotingConfigExclusionAction.java @@ -23,17 +23,13 @@ import org.elasticsearch.action.admin.cluster.configuration.AddVotingConfigExclusionsRequest; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -48,10 +44,8 @@ public String getName() { } @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_cluster/voting_config_exclusions/{node_name}", singletonList(POST)) - .map()); + public List handledRoutes() { + return singletonList(new Route("/_cluster/voting_config_exclusions/{node_name}", POST)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCancelTasksAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCancelTasksAction.java index bce836c64a853..75b2cb5f8d8f1 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCancelTasksAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCancelTasksAction.java @@ -23,19 +23,16 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.tasks.TaskId; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; import java.util.function.Supplier; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.action.admin.cluster.RestListTasksAction.listTasksResponseListener; @@ -53,11 +50,9 @@ public String getName() { } @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_tasks/_cancel", singletonList(POST)) - .put("/_tasks/{task_id}/_cancel", singletonList(POST)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList(new Route("/_tasks/_cancel", POST), + new Route("/_tasks/{task_id}/_cancel", POST))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCleanupRepositoryAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCleanupRepositoryAction.java index 5727b72fd84c5..aa4421ea75d72 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCleanupRepositoryAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCleanupRepositoryAction.java @@ -21,16 +21,12 @@ import org.elasticsearch.action.admin.cluster.repositories.cleanup.CleanupRepositoryRequest; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; import static org.elasticsearch.client.Requests.cleanupRepositoryRequest; @@ -42,10 +38,8 @@ public class RestCleanupRepositoryAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_snapshot/{repository}/_cleanup", singletonList(POST)) - .map()); + public List handledRoutes() { + return singletonList(new Route("/_snapshot/{repository}/_cleanup", POST)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClearVotingConfigExclusionsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClearVotingConfigExclusionsAction.java index 332854559e718..d07c94a4a7563 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClearVotingConfigExclusionsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClearVotingConfigExclusionsAction.java @@ -22,16 +22,12 @@ import org.elasticsearch.action.admin.cluster.configuration.ClearVotingConfigExclusionsAction; import org.elasticsearch.action.admin.cluster.configuration.ClearVotingConfigExclusionsRequest; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; import static org.elasticsearch.rest.RestRequest.Method.DELETE; @@ -39,10 +35,8 @@ public class RestClearVotingConfigExclusionsAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_cluster/voting_config_exclusions", singletonList(DELETE)) - .map()); + public List handledRoutes() { + return singletonList(new Route("/_cluster/voting_config_exclusions", DELETE)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterAllocationExplainAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterAllocationExplainAction.java index 9ade44cd4a686..7a58e4cda682b 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterAllocationExplainAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterAllocationExplainAction.java @@ -22,22 +22,18 @@ import org.elasticsearch.action.admin.cluster.allocation.ClusterAllocationExplainRequest; import org.elasticsearch.action.admin.cluster.allocation.ClusterAllocationExplainResponse; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; import static java.util.Arrays.asList; import static java.util.Collections.unmodifiableList; @@ -50,10 +46,10 @@ public class RestClusterAllocationExplainAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_cluster/allocation/explain", unmodifiableList(asList(GET, POST))) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_cluster/allocation/explain", GET), + new Route("/_cluster/allocation/explain", POST))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterGetSettingsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterGetSettingsAction.java index 7538fe830c67e..14c348f5649de 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterGetSettingsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterGetSettingsAction.java @@ -25,7 +25,6 @@ import org.elasticsearch.client.Requests; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.cluster.ClusterState; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.settings.ClusterSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.SettingsFilter; @@ -34,15 +33,12 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; import java.util.Set; import static java.util.Collections.singletonList; @@ -61,10 +57,8 @@ public RestClusterGetSettingsAction(Settings settings, ClusterSettings clusterSe } @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_cluster/settings", singletonList(GET)) - .map()); + public List handledRoutes() { + return singletonList(new Route("/_cluster/settings", GET)); } @Override public String getName() { diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterHealthAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterHealthAction.java index 82e67debc0880..613331f8fbd94 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterHealthAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterHealthAction.java @@ -26,31 +26,27 @@ import org.elasticsearch.cluster.health.ClusterHealthStatus; import org.elasticsearch.common.Priority; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestStatusToXContentListener; import java.io.IOException; import java.util.Collections; import java.util.List; import java.util.Locale; -import java.util.Map; import java.util.Set; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.client.Requests.clusterHealthRequest; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestClusterHealthAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_cluster/health", singletonList(GET)) - .put("/_cluster/health/{index}", singletonList(GET)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList(new Route("/_cluster/health", GET), + new Route("/_cluster/health/{index}", GET))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterRerouteAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterRerouteAction.java index 69bc807b75ec6..e33d950a0e8bd 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterRerouteAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterRerouteAction.java @@ -26,14 +26,12 @@ import org.elasticsearch.cluster.routing.allocation.command.AllocationCommands; import org.elasticsearch.common.ParseField; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.SettingsFilter; import org.elasticsearch.common.xcontent.ObjectParser; import org.elasticsearch.common.xcontent.ObjectParser.ValueType; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; @@ -41,7 +39,6 @@ import java.util.EnumSet; import java.util.HashSet; import java.util.List; -import java.util.Map; import java.util.Set; import static java.util.Collections.singletonList; @@ -65,10 +62,8 @@ public RestClusterRerouteAction(SettingsFilter settingsFilter) { } @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_cluster/reroute", singletonList(POST)) - .map()); + public List handledRoutes() { + return singletonList(new Route("/_cluster/reroute", POST)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterSearchShardsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterSearchShardsAction.java index 22622d071346a..55969bc892015 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterSearchShardsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterSearchShardsAction.java @@ -24,16 +24,12 @@ import org.elasticsearch.client.Requests; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; import static java.util.Arrays.asList; import static java.util.Collections.unmodifiableList; @@ -43,11 +39,12 @@ public class RestClusterSearchShardsAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_search_shards", unmodifiableList(asList(GET, POST))) - .put("/{index}/_search_shards", unmodifiableList(asList(GET, POST))) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_search_shards", GET), + new Route("/_search_shards", POST), + new Route("/{index}/_search_shards", GET), + new Route("/{index}/_search_shards", POST))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterStateAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterStateAction.java index 26b3f71d7bfaa..de95a90fd2256 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterStateAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterStateAction.java @@ -26,14 +26,12 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.SettingsFilter; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -43,10 +41,10 @@ import java.util.EnumSet; import java.util.HashSet; import java.util.List; -import java.util.Map; import java.util.Set; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestClusterStateAction extends BaseRestHandler { @@ -63,12 +61,11 @@ public String getName() { } @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_cluster/state", singletonList(GET)) - .put("/_cluster/state/{metric}", singletonList(GET)) - .put("/_cluster/state/{metric}/{indices}", singletonList(GET)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_cluster/state", GET), + new Route("/_cluster/state/{metric}", GET), + new Route("/_cluster/state/{metric}/{indices}", GET))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterStatsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterStatsAction.java index dba1711c48439..41aca857cfee8 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterStatsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterStatsAction.java @@ -21,28 +21,24 @@ import org.elasticsearch.action.admin.cluster.stats.ClusterStatsRequest; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestActions.NodesResponseRestListener; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestClusterStatsAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_cluster/stats", singletonList(GET)) - .put("/_cluster/stats/nodes/{nodeId}", singletonList(GET)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_cluster/stats", GET), + new Route("/_cluster/stats/nodes/{nodeId}", GET))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterUpdateSettingsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterUpdateSettingsAction.java index 1bddfa7b8b308..614b22a201217 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterUpdateSettingsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterUpdateSettingsAction.java @@ -22,16 +22,13 @@ import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest; import org.elasticsearch.client.Requests; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; -import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Set; @@ -45,10 +42,8 @@ public class RestClusterUpdateSettingsAction extends BaseRestHandler { private static final String TRANSIENT = "transient"; @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_cluster/settings", singletonList(PUT)) - .map()); + public List handledRoutes() { + return singletonList(new Route("/_cluster/settings", PUT)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCreateSnapshotAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCreateSnapshotAction.java index 74ab9aa2fbf90..840f9ea6a28dd 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCreateSnapshotAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCreateSnapshotAction.java @@ -21,16 +21,12 @@ import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotRequest; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; import static java.util.Arrays.asList; import static java.util.Collections.unmodifiableList; @@ -44,10 +40,10 @@ public class RestCreateSnapshotAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_snapshot/{repository}/{snapshot}", unmodifiableList(asList(PUT, POST))) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_snapshot/{repository}/{snapshot}", PUT), + new Route("/_snapshot/{repository}/{snapshot}", POST))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteRepositoryAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteRepositoryAction.java index d2fb0d8426311..ee79820d22129 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteRepositoryAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteRepositoryAction.java @@ -21,16 +21,12 @@ import org.elasticsearch.action.admin.cluster.repositories.delete.DeleteRepositoryRequest; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; import static org.elasticsearch.client.Requests.deleteRepositoryRequest; @@ -42,10 +38,8 @@ public class RestDeleteRepositoryAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_snapshot/{repository}", singletonList(DELETE)) - .map()); + public List handledRoutes() { + return singletonList(new Route("/_snapshot/{repository}", DELETE)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteSnapshotAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteSnapshotAction.java index 21fd9fb56d0c4..8249d64f20bd5 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteSnapshotAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteSnapshotAction.java @@ -21,16 +21,12 @@ import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotRequest; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; import static org.elasticsearch.client.Requests.deleteSnapshotRequest; @@ -42,10 +38,8 @@ public class RestDeleteSnapshotAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_snapshot/{repository}/{snapshot}", singletonList(DELETE)) - .map()); + public List handledRoutes() { + return singletonList(new Route("/_snapshot/{repository}/{snapshot}", DELETE)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteStoredScriptAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteStoredScriptAction.java index f3e6125be9eb8..8a93865857a19 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteStoredScriptAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteStoredScriptAction.java @@ -20,16 +20,12 @@ import org.elasticsearch.action.admin.cluster.storedscripts.DeleteStoredScriptRequest; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; import static org.elasticsearch.rest.RestRequest.Method.DELETE; @@ -37,10 +33,8 @@ public class RestDeleteStoredScriptAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_scripts/{id}", singletonList(DELETE)) - .map()); + public List handledRoutes() { + return singletonList(new Route("/_scripts/{id}", DELETE)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetRepositoriesAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetRepositoriesAction.java index 1d610e353e13f..82276f67c6aa3 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetRepositoriesAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetRepositoriesAction.java @@ -22,21 +22,18 @@ import org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesRequest; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.SettingsFilter; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; import java.util.Set; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.client.Requests.getRepositoryRequest; import static org.elasticsearch.rest.RestRequest.Method.GET; @@ -57,11 +54,10 @@ public String getName() { } @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_snapshot", singletonList(GET)) - .put("/_snapshot/{repository}", singletonList(GET)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_snapshot", GET), + new Route("/_snapshot/{repository}", GET))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetScriptContextAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetScriptContextAction.java index a2240c2494539..c0f1f0d30bf2e 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetScriptContextAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetScriptContextAction.java @@ -24,13 +24,10 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; import static org.elasticsearch.rest.RestRequest.Method.GET; @@ -38,8 +35,8 @@ public class RestGetScriptContextAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(Collections.singletonMap("/_script_context", singletonList(GET))); + public List handledRoutes() { + return singletonList(new Route("/_script_context", GET)); } @Override public String getName() { diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetScriptLanguageAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetScriptLanguageAction.java index 0c5c2498f219d..707ebe463829c 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetScriptLanguageAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetScriptLanguageAction.java @@ -24,22 +24,19 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestGetScriptLanguageAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_script_language", singletonList(GET)); + public List handledRoutes() { + return singletonList(new Route("/_script_language", GET)); } @Override public String getName() { diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetSnapshotsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetSnapshotsAction.java index 18ca178e9e96e..3bd8faa2cf8b5 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetSnapshotsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetSnapshotsAction.java @@ -24,15 +24,12 @@ import org.elasticsearch.common.Strings; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.client.Requests.getSnapshotsRequest; import static org.elasticsearch.rest.RestRequest.Method.GET; @@ -42,8 +39,8 @@ public class RestGetSnapshotsAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_snapshot/{repository}/{snapshot}", singletonList(GET)); + public List handledRoutes() { + return singletonList(new Route("/_snapshot/{repository}/{snapshot}", GET)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetStoredScriptAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetStoredScriptAction.java index 2e8baca6fca05..09059c218c760 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetStoredScriptAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetStoredScriptAction.java @@ -22,22 +22,19 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestStatusToXContentListener; import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestGetStoredScriptAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_scripts/{id}", singletonList(GET)); + public List handledRoutes() { + return singletonList(new Route("/_scripts/{id}", GET)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetTaskAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetTaskAction.java index a42dd628b33e4..357f8342ab94c 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetTaskAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetTaskAction.java @@ -24,23 +24,20 @@ import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.tasks.TaskId; import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestGetTaskAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_tasks/{task_id}", singletonList(GET)); + public List handledRoutes() { + return singletonList(new Route("/_tasks/{task_id}", GET)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestListTasksAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestListTasksAction.java index aaa5996283227..2ab497a956a8e 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestListTasksAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestListTasksAction.java @@ -31,7 +31,6 @@ import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -40,11 +39,9 @@ import java.io.IOException; import java.util.List; -import java.util.Map; import java.util.function.Supplier; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; @@ -57,8 +54,8 @@ public RestListTasksAction(Supplier nodesInCluster) { } @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_tasks", singletonList(GET)); + public List handledRoutes() { + return singletonList(new Route("/_tasks", GET)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesHotThreadsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesHotThreadsAction.java index 17fdd09a69a52..ce4428d2da49c 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesHotThreadsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesHotThreadsAction.java @@ -24,39 +24,35 @@ import org.elasticsearch.action.admin.cluster.node.hotthreads.NodesHotThreadsResponse; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestResponseListener; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestNodesHotThreadsAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_cluster/nodes/hotthreads", singletonList(GET)) - .put("/_cluster/nodes/hot_threads", singletonList(GET)) - .put("/_cluster/nodes/{nodeId}/hotthreads", singletonList(GET)) - .put("/_cluster/nodes/{nodeId}/hot_threads", singletonList(GET)) - .put("/_nodes/hotthreads", singletonList(GET)) - .put("/_nodes/hot_threads", singletonList(GET)) - .put("/_nodes/{nodeId}/hotthreads", singletonList(GET)) - .put("/_nodes/{nodeId}/hot_threads", singletonList(GET)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_cluster/nodes/hotthreads", GET), + new Route("/_cluster/nodes/hot_threads", GET), + new Route("/_cluster/nodes/{nodeId}/hotthreads", GET), + new Route("/_cluster/nodes/{nodeId}/hot_threads", GET), + new Route("/_nodes/hotthreads", GET), + new Route("/_nodes/hot_threads", GET), + new Route("/_nodes/{nodeId}/hotthreads", GET), + new Route("/_nodes/{nodeId}/hot_threads", GET))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesInfoAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesInfoAction.java index 464eb04e00114..ab1fa61e50f2a 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesInfoAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesInfoAction.java @@ -22,22 +22,19 @@ import org.elasticsearch.action.admin.cluster.node.info.NodesInfoRequest; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.SettingsFilter; import org.elasticsearch.common.util.set.Sets; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestActions.NodesResponseRestListener; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; import java.util.Set; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestNodesInfoAction extends BaseRestHandler { @@ -60,15 +57,14 @@ public RestNodesInfoAction(SettingsFilter settingsFilter) { } @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_nodes", singletonList(GET)) + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_nodes", GET), // this endpoint is used for metrics, not for node IDs, like /_nodes/fs - .put("/_nodes/{nodeId}", singletonList(GET)) - .put("/_nodes/{nodeId}/{metrics}", singletonList(GET)) + new Route("/_nodes/{nodeId}", GET), + new Route("/_nodes/{nodeId}/{metrics}", GET), // added this endpoint to be aligned with stats - .put("/_nodes/{nodeId}/info/{metrics}", singletonList(GET)) - .map()); + new Route("/_nodes/{nodeId}/info/{metrics}", GET))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsAction.java index a3efb2d95ac65..247530811ee32 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsAction.java @@ -24,10 +24,8 @@ import org.elasticsearch.action.admin.indices.stats.CommonStatsFlags.Flag; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestActions.NodesResponseRestListener; import java.io.IOException; @@ -40,22 +38,22 @@ import java.util.TreeSet; import java.util.function.Consumer; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static java.util.Map.entry; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestNodesStatsAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_nodes/stats", singletonList(GET)) - .put("/_nodes/{nodeId}/stats", singletonList(GET)) - .put("/_nodes/stats/{metric}", singletonList(GET)) - .put("/_nodes/{nodeId}/stats/{metric}", singletonList(GET)) - .put("/_nodes/stats/{metric}/{index_metric}", singletonList(GET)) - .put("/_nodes/{nodeId}/stats/{metric}/{index_metric}", singletonList(GET)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_nodes/stats", GET), + new Route("/_nodes/{nodeId}/stats", GET), + new Route("/_nodes/stats/{metric}", GET), + new Route("/_nodes/{nodeId}/stats/{metric}", GET), + new Route("/_nodes/stats/{metric}/{index_metric}", GET), + new Route("/_nodes/{nodeId}/stats/{metric}/{index_metric}", GET))); } static final Map> METRICS = Map.ofEntries( diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesUsageAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesUsageAction.java index 191086d4c11f3..28a5dbc41a642 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesUsageAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesUsageAction.java @@ -23,37 +23,33 @@ import org.elasticsearch.action.admin.cluster.node.usage.NodesUsageResponse; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestActions; import org.elasticsearch.rest.action.RestBuilderListener; import java.io.IOException; -import java.util.Collections; import java.util.List; import java.util.Locale; -import java.util.Map; import java.util.Set; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestNodesUsageAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_nodes/usage", singletonList(GET)) - .put("/_nodes/{nodeId}/usage", singletonList(GET)) - .put("/_nodes/usage/{metric}", singletonList(GET)) - .put("/_nodes/{nodeId}/usage/{metric}", singletonList(GET)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_nodes/usage", GET), + new Route("/_nodes/{nodeId}/usage", GET), + new Route("/_nodes/usage/{metric}", GET), + new Route("/_nodes/{nodeId}/usage/{metric}", GET))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPendingClusterTasksAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPendingClusterTasksAction.java index 201ce1cf12364..f4a5de4aec7b4 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPendingClusterTasksAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPendingClusterTasksAction.java @@ -23,22 +23,19 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestPendingClusterTasksAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_cluster/pending_tasks", singletonList(GET)); + public List handledRoutes() { + return singletonList(new Route("/_cluster/pending_tasks", GET)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPutRepositoryAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPutRepositoryAction.java index 1436146d7db51..4dec6ae142314 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPutRepositoryAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPutRepositoryAction.java @@ -24,15 +24,12 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Arrays.asList; -import static java.util.Collections.singletonMap; import static java.util.Collections.unmodifiableList; import static org.elasticsearch.client.Requests.putRepositoryRequest; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -44,8 +41,10 @@ public class RestPutRepositoryAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_snapshot/{repository}", unmodifiableList(asList(PUT, POST))); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_snapshot/{repository}", POST), + new Route("/_snapshot/{repository}", PUT))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPutStoredScriptAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPutStoredScriptAction.java index 3e1432429313e..9100125c72754 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPutStoredScriptAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPutStoredScriptAction.java @@ -21,18 +21,14 @@ import org.elasticsearch.action.admin.cluster.storedscripts.PutStoredScriptRequest; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.bytes.BytesReference; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.script.StoredScriptSource; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; import static java.util.Arrays.asList; import static java.util.Collections.unmodifiableList; @@ -42,11 +38,12 @@ public class RestPutStoredScriptAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_scripts/{id}", unmodifiableList(asList(PUT, POST))) - .put("/_scripts/{id}/{context}", unmodifiableList(asList(PUT, POST))) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_scripts/{id}", POST), + new Route("/_scripts/{id}", PUT), + new Route("/_scripts/{id}/{context}", POST), + new Route("/_scripts/{id}/{context}", PUT))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestReloadSecureSettingsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestReloadSecureSettingsAction.java index 4708653eed288..a15e62f703816 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestReloadSecureSettingsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestReloadSecureSettingsAction.java @@ -25,25 +25,22 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.ParseField; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.settings.SecureString; import org.elasticsearch.common.xcontent.ObjectParser; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestActions; import org.elasticsearch.rest.action.RestBuilderListener; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.POST; public final class RestReloadSecureSettingsAction extends BaseRestHandler { @@ -62,11 +59,10 @@ public String getName() { } @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_nodes/reload_secure_settings", singletonList(POST)) - .put("/_nodes/{nodeId}/reload_secure_settings", singletonList(POST)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_nodes/reload_secure_settings", POST), + new Route("/_nodes/{nodeId}/reload_secure_settings", POST))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestRemoteClusterInfoAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestRemoteClusterInfoAction.java index 0e68f6aa4cf4b..1d0d46ce525fd 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestRemoteClusterInfoAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestRemoteClusterInfoAction.java @@ -24,21 +24,18 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; public final class RestRemoteClusterInfoAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("_remote/info", singletonList(GET)); + public List handledRoutes() { + return singletonList(new Route("_remote/info", GET)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestRestoreSnapshotAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestRestoreSnapshotAction.java index 69c99498b10e5..4276880a8a48e 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestRestoreSnapshotAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestRestoreSnapshotAction.java @@ -23,15 +23,12 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.client.Requests.restoreSnapshotRequest; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -41,8 +38,8 @@ public class RestRestoreSnapshotAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_snapshot/{repository}/{snapshot}/_restore", singletonList(POST)); + public List handledRoutes() { + return singletonList(new Route("/_snapshot/{repository}/{snapshot}/_restore", POST)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestSnapshotsStatusAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestSnapshotsStatusAction.java index e31dc2d3cac97..de29792d589b6 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestSnapshotsStatusAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestSnapshotsStatusAction.java @@ -22,18 +22,15 @@ import org.elasticsearch.action.admin.cluster.snapshots.status.SnapshotsStatusRequest; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.client.Requests.snapshotsStatusRequest; import static org.elasticsearch.rest.RestRequest.Method.GET; @@ -43,12 +40,11 @@ public class RestSnapshotsStatusAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_snapshot/{repository}/{snapshot}/_status", singletonList(GET)) - .put("/_snapshot/{repository}/_status", singletonList(GET)) - .put("/_snapshot/_status", singletonList(GET)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_snapshot/{repository}/{snapshot}/_status", GET), + new Route("/_snapshot/{repository}/_status", GET), + new Route("/_snapshot/_status", GET))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestVerifyRepositoryAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestVerifyRepositoryAction.java index 15c3c155c9c0b..c2c557d58d03a 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestVerifyRepositoryAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestVerifyRepositoryAction.java @@ -23,23 +23,20 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.client.Requests.verifyRepositoryRequest; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestVerifyRepositoryAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_snapshot/{repository}/_verify", singletonList(POST)); + public List handledRoutes() { + return singletonList(new Route("/_snapshot/{repository}/_verify", POST)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestAnalyzeAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestAnalyzeAction.java index 0c6eaf25a2ee9..357aa0ee42c0e 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestAnalyzeAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestAnalyzeAction.java @@ -21,17 +21,13 @@ import org.elasticsearch.action.admin.indices.analyze.AnalyzeAction; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.ParseField; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; import static java.util.Arrays.asList; import static java.util.Collections.unmodifiableList; @@ -53,11 +49,12 @@ public static class Fields { } @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_analyze", unmodifiableList(asList(GET, POST))) - .put("/{index}/_analyze", unmodifiableList(asList(GET, POST))) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_analyze", GET), + new Route("/_analyze", POST), + new Route("/{index}/_analyze", GET), + new Route("/{index}/_analyze", POST))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestClearIndicesCacheAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestClearIndicesCacheAction.java index 30d67849b6917..c48e4bc882034 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestClearIndicesCacheAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestClearIndicesCacheAction.java @@ -23,28 +23,24 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestClearIndicesCacheAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_cache/clear", singletonList(POST)) - .put("/{index}/_cache/clear", singletonList(POST)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_cache/clear", POST), + new Route("/{index}/_cache/clear", POST))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCloseIndexAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCloseIndexAction.java index 51e62d4d8cb28..11cf94358c8ee 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCloseIndexAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCloseIndexAction.java @@ -24,28 +24,24 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestCloseIndexAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_close", singletonList(POST)) - .put("/{index}/_close", singletonList(POST)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_close", POST), + new Route("/{index}/_close", POST))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCreateIndexAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCreateIndexAction.java index 9227b475619e0..dea25679dee02 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCreateIndexAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCreateIndexAction.java @@ -27,7 +27,6 @@ import org.elasticsearch.index.mapper.MapperService; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; @@ -42,8 +41,8 @@ public class RestCreateIndexAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/{index}", singletonList(PUT)); + public List handledRoutes() { + return singletonList(new Route("/{index}", PUT)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestDeleteIndexAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestDeleteIndexAction.java index a2f1a22bb87ae..ace876907af61 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestDeleteIndexAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestDeleteIndexAction.java @@ -23,28 +23,24 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.DELETE; public class RestDeleteIndexAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/", singletonList(DELETE)) - .put("/{index}", singletonList(DELETE)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/", DELETE), + new Route("/{index}", DELETE))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestDeleteIndexTemplateAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestDeleteIndexTemplateAction.java index ea22cdcfdc1bb..44b231ce84f19 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestDeleteIndexTemplateAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestDeleteIndexTemplateAction.java @@ -22,22 +22,19 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.DELETE; public class RestDeleteIndexTemplateAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_template/{name}", singletonList(DELETE)); + public List handledRoutes() { + return singletonList(new Route("/_template/{name}", DELETE)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestFlushAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestFlushAction.java index 7b2feb2ee7a5e..99222bbd1cb3c 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestFlushAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestFlushAction.java @@ -23,16 +23,12 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; import static java.util.Arrays.asList; import static java.util.Collections.unmodifiableList; @@ -42,11 +38,12 @@ public class RestFlushAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_flush", unmodifiableList(asList(POST, GET))) - .put("/{index}/_flush", unmodifiableList(asList(POST, GET))) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_flush", GET), + new Route("/_flush", POST), + new Route("/{index}/_flush", GET), + new Route("/{index}/_flush", POST))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestForceMergeAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestForceMergeAction.java index 17198f6c40605..10996ef7e9110 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestForceMergeAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestForceMergeAction.java @@ -23,28 +23,24 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestForceMergeAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_forcemerge", singletonList(POST)) - .put("/{index}/_forcemerge", singletonList(POST)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_forcemerge", POST), + new Route("/{index}/_forcemerge", POST))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetAliasesAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetAliasesAction.java index 21bcab41bdac2..13259b23bcc32 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetAliasesAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetAliasesAction.java @@ -28,30 +28,25 @@ import org.elasticsearch.cluster.metadata.MetaData; import org.elasticsearch.common.Strings; import org.elasticsearch.common.collect.ImmutableOpenMap; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.regex.Regex; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; import java.io.IOException; -import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Locale; -import java.util.Map; import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; import static java.util.Arrays.asList; -import static java.util.Collections.singletonList; import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.HEAD; @@ -62,14 +57,16 @@ public class RestGetAliasesAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_alias", singletonList(GET)) - .put("/_aliases", singletonList(GET)) - .put("/_alias/{name}", unmodifiableList(asList(GET, HEAD))) - .put("/{index}/_alias", unmodifiableList(asList(GET, HEAD))) - .put("/{index}/_alias/{name}", unmodifiableList(asList(GET, HEAD))) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_alias", GET), + new Route("/_aliases", GET), + new Route("/_alias/{name}", GET), + new Route("/_alias/{name}", HEAD), + new Route("/{index}/_alias", GET), + new Route("/{index}/_alias", HEAD), + new Route("/{index}/_alias/{name}", GET), + new Route("/{index}/_alias/{name}", HEAD))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetFieldMappingAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetFieldMappingAction.java index ed298bf612f79..4762e3c022af8 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetFieldMappingAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetFieldMappingAction.java @@ -25,22 +25,20 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; import java.io.IOException; -import java.util.Collections; import java.util.List; import java.util.Map; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestStatus.NOT_FOUND; import static org.elasticsearch.rest.RestStatus.OK; @@ -48,11 +46,10 @@ public class RestGetFieldMappingAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_mapping/field/{fields}", singletonList(GET)) - .put("/{index}/_mapping/field/{fields}", singletonList(GET)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_mapping/field/{fields}", GET), + new Route("/{index}/_mapping/field/{fields}", GET))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndexTemplateAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndexTemplateAction.java index 168f91690e074..a20b9cb3e2108 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndexTemplateAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndexTemplateAction.java @@ -23,22 +23,17 @@ import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; import java.util.Set; import static java.util.Arrays.asList; -import static java.util.Collections.singletonList; import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.HEAD; @@ -51,11 +46,11 @@ public class RestGetIndexTemplateAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_template", singletonList(GET)) - .put("/_template/{name}", unmodifiableList(asList(GET, HEAD))) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_template", GET), + new Route("/_template/{name}", GET), + new Route("/_template/{name}", HEAD))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndicesAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndicesAction.java index e1de4f702a713..4687bdff35936 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndicesAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndicesAction.java @@ -27,16 +27,13 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; import java.util.List; -import java.util.Map; import java.util.Set; import static java.util.Arrays.asList; -import static java.util.Collections.singletonMap; import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.HEAD; @@ -47,8 +44,10 @@ public class RestGetIndicesAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/{index}", unmodifiableList(asList(GET, HEAD))); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/{index}", GET), + new Route("/{index}", HEAD))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetMappingAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetMappingAction.java index e76a69d476b2f..33c5e1c0f5a52 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetMappingAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetMappingAction.java @@ -24,34 +24,30 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestGetMappingAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_mapping", singletonList(GET)) - .put("/_mappings", singletonList(GET)) - .put("/{index}/_mapping", singletonList(GET)) - .put("/{index}/_mappings", singletonList(GET)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_mapping", GET), + new Route("/_mappings", GET), + new Route("/{index}/_mapping", GET), + new Route("/{index}/_mappings", GET))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetSettingsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetSettingsAction.java index 9bde53d8a0edf..c16fa4400d0aa 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetSettingsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetSettingsAction.java @@ -23,31 +23,27 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestGetSettingsAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_settings", singletonList(GET)) - .put("/_settings/{name}", singletonList(GET)) - .put("/{index}/_settings", singletonList(GET)) - .put("/{index}/_settings/{name}", singletonList(GET)) - .put("/{index}/_setting/{name}", singletonList(GET)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_settings", GET), + new Route("/_settings/{name}", GET), + new Route("/{index}/_settings", GET), + new Route("/{index}/_settings/{name}", GET), + new Route("/{index}/_setting/{name}", GET))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndexDeleteAliasesAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndexDeleteAliasesAction.java index 19a86ff25f57f..2f5035b7a01e1 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndexDeleteAliasesAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndexDeleteAliasesAction.java @@ -22,28 +22,24 @@ import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest.AliasActions; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.DELETE; public class RestIndexDeleteAliasesAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/{index}/_alias/{name}", singletonList(DELETE)) - .put("/{index}/_aliases/{name}", singletonList(DELETE)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/{index}/_alias/{name}", DELETE), + new Route("/{index}/_aliases/{name}", DELETE))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndexPutAliasAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndexPutAliasAction.java index 21dff51d7c4c7..181458ba695a1 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndexPutAliasAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndexPutAliasAction.java @@ -22,20 +22,16 @@ import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest.AliasActions; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; -import java.util.Collections; import java.util.List; import java.util.Map; import static java.util.Arrays.asList; -import static java.util.Collections.singletonList; import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.RestRequest.Method.PUT; @@ -43,17 +39,20 @@ public class RestIndexPutAliasAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/{index}/_alias/{name}", unmodifiableList(asList(POST, PUT))) - .put("/_alias/{name}", unmodifiableList(asList(POST, PUT))) - .put("/{index}/_aliases/{name}", unmodifiableList(asList(POST, PUT))) - .put("/_aliases/{name}", unmodifiableList(asList(POST, PUT))) - .put("/{index}/_alias", singletonList(PUT)) - .put("/{index}/_aliases", singletonList(PUT)) - .put("/_alias", singletonList(PUT)) - .put("/{index}/_alias", singletonList(PUT)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/{index}/_alias/{name}", POST), + new Route("/{index}/_alias/{name}", PUT), + new Route("/_alias/{name}", POST), + new Route("/_alias/{name}", PUT), + new Route("/{index}/_aliases/{name}", POST), + new Route("/{index}/_aliases/{name}", PUT), + new Route("/_aliases/{name}", POST), + new Route("/_aliases/{name}", PUT), + new Route("/{index}/_alias", PUT), + new Route("/{index}/_aliases", PUT), + new Route("/_alias", PUT), + new Route("/{index}/_alias", PUT))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesAliasesAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesAliasesAction.java index 53d1e475aef21..076acd43cae34 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesAliasesAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesAliasesAction.java @@ -24,15 +24,12 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestIndicesAliasesAction extends BaseRestHandler { @@ -43,8 +40,8 @@ public String getName() { } @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_aliases", singletonList(POST)); + public List handledRoutes() { + return singletonList(new Route("/_aliases", POST)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesSegmentsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesSegmentsAction.java index 05107010e7128..ceee6155f1a95 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesSegmentsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesSegmentsAction.java @@ -23,28 +23,24 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestIndicesSegmentsAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_segments", singletonList(GET)) - .put("/{index}/_segments", singletonList(GET)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_segments", GET), + new Route("/{index}/_segments", GET))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesShardStoresAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesShardStoresAction.java index 82b32ac6df989..67794e3f5b8f5 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesShardStoresAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesShardStoresAction.java @@ -25,21 +25,18 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestBuilderListener; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestStatus.OK; @@ -49,11 +46,10 @@ public class RestIndicesShardStoresAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_shard_stores", singletonList(GET)) - .put("/{index}/_shard_stores", singletonList(GET)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_shard_stores", GET), + new Route("/{index}/_shard_stores", GET))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsAction.java index fcaa4d7e8c0bf..dcae0372613e1 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsAction.java @@ -25,10 +25,8 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; @@ -41,19 +39,19 @@ import java.util.TreeSet; import java.util.function.Consumer; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestIndicesStatsAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_stats", singletonList(GET)) - .put("/_stats/{metric}", singletonList(GET)) - .put("/{index}/_stats", singletonList(GET)) - .put("/{index}/_stats/{metric}", singletonList(GET)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_stats", GET), + new Route("/_stats/{metric}", GET), + new Route("/{index}/_stats", GET), + new Route("/{index}/_stats/{metric}", GET))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestOpenIndexAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestOpenIndexAction.java index 27eff71bab1c8..16f65bc3b5df3 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestOpenIndexAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestOpenIndexAction.java @@ -24,28 +24,24 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestOpenIndexAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_open", singletonList(POST)) - .put("/{index}/_open", singletonList(POST)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_open", POST), + new Route("/{index}/_open", POST))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutIndexTemplateAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutIndexTemplateAction.java index 2ef5a8f4e4500..a3a6dac7a5820 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutIndexTemplateAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutIndexTemplateAction.java @@ -25,7 +25,6 @@ import org.elasticsearch.common.xcontent.XContentHelper; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; @@ -33,7 +32,6 @@ import java.util.Map; import static java.util.Arrays.asList; -import static java.util.Collections.singletonMap; import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.RestRequest.Method.PUT; @@ -41,8 +39,10 @@ public class RestPutIndexTemplateAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_template/{name}", unmodifiableList(asList(PUT, POST))); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_template/{name}", POST), + new Route("/_template/{name}", PUT))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutMappingAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutMappingAction.java index 2d1d64ac52779..de837f1fa9e97 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutMappingAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutMappingAction.java @@ -23,16 +23,13 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.xcontent.XContentHelper; import org.elasticsearch.index.mapper.MapperService; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; -import java.util.Collections; import java.util.List; import java.util.Map; @@ -45,11 +42,12 @@ public class RestPutMappingAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/{index}/_mapping/", unmodifiableList(asList(POST, PUT))) - .put("/{index}/_mappings/", unmodifiableList(asList(POST, PUT))) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/{index}/_mapping/", POST), + new Route("/{index}/_mapping/", PUT), + new Route("/{index}/_mappings/", POST), + new Route("/{index}/_mappings/", PUT))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRecoveryAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRecoveryAction.java index e7590858e31f9..c908c143a2e22 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRecoveryAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRecoveryAction.java @@ -23,18 +23,15 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; /** @@ -43,11 +40,10 @@ public class RestRecoveryAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_recovery", singletonList(GET)) - .put("/{index}/_recovery", singletonList(GET)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_recovery", GET), + new Route("/{index}/_recovery", GET))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRefreshAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRefreshAction.java index 07754472021fd..5f052cab74f93 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRefreshAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRefreshAction.java @@ -24,17 +24,13 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; import static java.util.Arrays.asList; import static java.util.Collections.unmodifiableList; @@ -44,11 +40,12 @@ public class RestRefreshAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_refresh", unmodifiableList(asList(GET, POST))) - .put("/{index}/_refresh", unmodifiableList(asList(GET, POST))) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_refresh", GET), + new Route("/_refresh", POST), + new Route("/{index}/_refresh", GET), + new Route("/{index}/_refresh", POST))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestResizeHandler.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestResizeHandler.java index f0d7f2dfe37c5..756d317979b53 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestResizeHandler.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestResizeHandler.java @@ -25,15 +25,12 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Arrays.asList; -import static java.util.Collections.singletonMap; import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.RestRequest.Method.PUT; @@ -62,8 +59,10 @@ public final RestChannelConsumer prepareRequest(final RestRequest request, final public static class RestShrinkIndexAction extends RestResizeHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/{index}/_shrink/{target}", unmodifiableList(asList(PUT, POST))); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/{index}/_shrink/{target}", POST), + new Route("/{index}/_shrink/{target}", PUT))); } @Override @@ -81,8 +80,10 @@ protected ResizeType getResizeType() { public static class RestSplitIndexAction extends RestResizeHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/{index}/_split/{target}", unmodifiableList(asList(PUT, POST))); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/{index}/_split/{target}", POST), + new Route("/{index}/_split/{target}", PUT))); } @Override @@ -100,8 +101,10 @@ protected ResizeType getResizeType() { public static class RestCloneIndexAction extends RestResizeHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/{index}/_clone/{target}", unmodifiableList(asList(PUT, POST))); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/{index}/_clone/{target}", POST), + new Route("/{index}/_clone/{target}", PUT))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRolloverIndexAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRolloverIndexAction.java index 135ec0dc094a6..e2e083a5f3aac 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRolloverIndexAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRolloverIndexAction.java @@ -22,28 +22,24 @@ import org.elasticsearch.action.admin.indices.rollover.RolloverRequest; import org.elasticsearch.action.support.ActiveShardCount; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestRolloverIndexAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/{index}/_rollover", singletonList(POST)) - .put("/{index}/_rollover/{new_index}", singletonList(POST)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/{index}/_rollover", POST), + new Route("/{index}/_rollover/{new_index}", POST))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestSyncedFlushAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestSyncedFlushAction.java index acfd2d51d3b66..0fc8a9fbdedad 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestSyncedFlushAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestSyncedFlushAction.java @@ -26,22 +26,18 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; import static java.util.Arrays.asList; import static java.util.Collections.unmodifiableList; @@ -54,11 +50,12 @@ public class RestSyncedFlushAction extends BaseRestHandler { private static final DeprecationLogger DEPRECATION_LOGGER = new DeprecationLogger(logger); @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_flush/synced", unmodifiableList(asList(GET, POST))) - .put("/{index}/_flush/synced", unmodifiableList(asList(GET, POST))) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_flush/synced", GET), + new Route("/_flush/synced", POST), + new Route("/{index}/_flush/synced", GET), + new Route("/{index}/_flush/synced", POST))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpdateSettingsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpdateSettingsAction.java index e525d529282e1..e313d6c920963 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpdateSettingsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpdateSettingsAction.java @@ -23,31 +23,27 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; import java.util.Set; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.client.Requests.updateSettingsRequest; import static org.elasticsearch.rest.RestRequest.Method.PUT; public class RestUpdateSettingsAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/{index}/_settings", singletonList(PUT)) - .put("/_settings", singletonList(PUT)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/{index}/_settings", PUT), + new Route("/_settings", PUT))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpgradeActionDeprecated.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpgradeActionDeprecated.java index 63ad1736779cf..962d74b8252bc 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpgradeActionDeprecated.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpgradeActionDeprecated.java @@ -27,16 +27,13 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; import java.util.Collections; import java.util.List; -import java.util.Map; import static java.util.Arrays.asList; -import static java.util.Collections.singletonList; import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -49,15 +46,15 @@ public class RestUpgradeActionDeprecated extends BaseRestHandler { "The _upgrade API is no longer useful and will be removed. Instead, see _reindex API."; @Override - public List deprecatedHandledMethodsAndPaths() { + public List deprecatedRoutes() { return unmodifiableList(asList( - new DeprecatedRestApi("/_upgrade", singletonList(POST), UPGRADE_API_DEPRECATION_MESSAGE, deprecationLogger), - new DeprecatedRestApi("/{index}/_upgrade", singletonList(POST), UPGRADE_API_DEPRECATION_MESSAGE, deprecationLogger))); + new DeprecatedRoute("/_upgrade", POST, UPGRADE_API_DEPRECATION_MESSAGE, deprecationLogger), + new DeprecatedRoute("/{index}/_upgrade", POST, UPGRADE_API_DEPRECATION_MESSAGE, deprecationLogger))); } @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpgradeStatusActionDeprecated.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpgradeStatusActionDeprecated.java index 343788d38c11e..d9169efd7a8d5 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpgradeStatusActionDeprecated.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpgradeStatusActionDeprecated.java @@ -27,16 +27,13 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; import java.util.Collections; import java.util.List; -import java.util.Map; import static java.util.Arrays.asList; -import static java.util.Collections.singletonList; import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.action.admin.indices.RestUpgradeActionDeprecated.UPGRADE_API_DEPRECATION_MESSAGE; @@ -47,15 +44,15 @@ public class RestUpgradeStatusActionDeprecated extends BaseRestHandler { LogManager.getLogger(RestUpgradeStatusActionDeprecated.class)); @Override - public List deprecatedHandledMethodsAndPaths() { + public List deprecatedRoutes() { return unmodifiableList(asList( - new DeprecatedRestApi("/_upgrade", singletonList(GET), UPGRADE_API_DEPRECATION_MESSAGE, deprecationLogger), - new DeprecatedRestApi("/{index}/_upgrade", singletonList(GET), UPGRADE_API_DEPRECATION_MESSAGE, deprecationLogger))); + new DeprecatedRoute("/_upgrade", GET, UPGRADE_API_DEPRECATION_MESSAGE, deprecationLogger), + new DeprecatedRoute("/{index}/_upgrade", GET, UPGRADE_API_DEPRECATION_MESSAGE, deprecationLogger))); } @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestValidateQueryAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestValidateQueryAction.java index d9ab81a1d84fe..203e20c0028d2 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestValidateQueryAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestValidateQueryAction.java @@ -26,20 +26,16 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.ParsingException; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestActions; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; import static java.util.Arrays.asList; import static java.util.Collections.unmodifiableList; @@ -50,11 +46,12 @@ public class RestValidateQueryAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_validate/query", unmodifiableList(asList(GET, POST))) - .put("/{index}/_validate/query", unmodifiableList(asList(GET, POST))) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_validate/query", GET), + new Route("/_validate/query", POST), + new Route("/{index}/_validate/query", GET), + new Route("/{index}/_validate/query", POST))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestAliasAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestAliasAction.java index 137d11392d61a..805a41a5827c9 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestAliasAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestAliasAction.java @@ -25,27 +25,23 @@ import org.elasticsearch.cluster.metadata.AliasMetaData; import org.elasticsearch.common.Strings; import org.elasticsearch.common.Table; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestResponseListener; -import java.util.Collections; import java.util.List; -import java.util.Map; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestAliasAction extends AbstractCatAction { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_cat/aliases", singletonList(GET)) - .put("/_cat/aliases/{alias}", singletonList(GET)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_cat/aliases", GET), + new Route("/_cat/aliases/{alias}", GET))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestAllocationAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestAllocationAction.java index e45ee833d708b..40005cc803f6e 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestAllocationAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestAllocationAction.java @@ -31,30 +31,26 @@ import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.common.Strings; import org.elasticsearch.common.Table; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestActionListener; import org.elasticsearch.rest.action.RestResponseListener; -import java.util.Collections; import java.util.List; -import java.util.Map; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestAllocationAction extends AbstractCatAction { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_cat/allocation", singletonList(GET)) - .put("/_cat/allocation/{nodes}", singletonList(GET)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_cat/allocation", GET), + new Route("/_cat/allocation/{nodes}", GET))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestCatAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestCatAction.java index 7b0a6f3bd4eef..625797c8902e4 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestCatAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestCatAction.java @@ -23,15 +23,12 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestStatus; import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestCatAction extends BaseRestHandler { @@ -50,8 +47,8 @@ public RestCatAction(List catActions) { } @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_cat", singletonList(GET)); + public List handledRoutes() { + return singletonList(new Route("/_cat", GET)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestCatRecoveryAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestCatRecoveryAction.java index 1334578da9336..19b54dec4de50 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestCatRecoveryAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestCatRecoveryAction.java @@ -28,23 +28,20 @@ import org.elasticsearch.cluster.routing.RecoverySource.SnapshotRecoverySource; import org.elasticsearch.common.Strings; import org.elasticsearch.common.Table; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.XContentElasticsearchExtension; import org.elasticsearch.indices.recovery.RecoveryState; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestResponseListener; -import java.util.Collections; import java.util.Comparator; import java.util.List; import java.util.Locale; -import java.util.Map; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; /** @@ -55,11 +52,10 @@ public class RestCatRecoveryAction extends AbstractCatAction { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_cat/recovery", singletonList(GET)) - .put("/_cat/recovery/{index}", singletonList(GET)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_cat/recovery", GET), + new Route("/_cat/recovery/{index}", GET))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestCountAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestCountAction.java index c90ceff03b466..68fc996252f0b 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestCountAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestCountAction.java @@ -26,31 +26,27 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; import org.elasticsearch.common.Table; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestActions; import org.elasticsearch.rest.action.RestResponseListener; import org.elasticsearch.search.builder.SearchSourceBuilder; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestCountAction extends AbstractCatAction { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_cat/count", singletonList(GET)) - .put("/_cat/count/{index}", singletonList(GET)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_cat/count", GET), + new Route("/_cat/count/{index}", GET))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestFielddataAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestFielddataAction.java index 11648e981adc1..42d8eedee437c 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestFielddataAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestFielddataAction.java @@ -25,18 +25,15 @@ import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Table; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestResponseListener; -import java.util.Collections; import java.util.List; -import java.util.Map; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; /** @@ -45,11 +42,10 @@ public class RestFielddataAction extends AbstractCatAction { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_cat/fielddata", singletonList(GET)) - .put("/_cat/fielddata/{fields}", singletonList(GET)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_cat/fielddata", GET), + new Route("/_cat/fielddata/{fields}", GET))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestHealthAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestHealthAction.java index eda3cf4290af0..0adec09a4c2ec 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestHealthAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestHealthAction.java @@ -24,23 +24,20 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Table; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestResponseListener; import java.util.List; import java.util.Locale; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestHealthAction extends AbstractCatAction { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_cat/health", singletonList(GET)); + public List handledRoutes() { + return singletonList(new Route("/_cat/health", GET)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestIndicesAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestIndicesAction.java index 5cc7bfc70c455..8c8e27635a339 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestIndicesAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestIndicesAction.java @@ -39,20 +39,17 @@ import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.Strings; import org.elasticsearch.common.Table; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.time.DateFormatter; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.index.IndexSettings; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestResponseListener; import java.time.Instant; import java.time.ZoneOffset; import java.time.ZonedDateTime; -import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashSet; @@ -64,7 +61,8 @@ import java.util.stream.Collectors; import java.util.stream.StreamSupport; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.action.support.master.MasterNodeRequest.DEFAULT_MASTER_NODE_TIMEOUT; import static org.elasticsearch.rest.RestRequest.Method.GET; @@ -73,11 +71,10 @@ public class RestIndicesAction extends AbstractCatAction { private static final DateFormatter STRICT_DATE_TIME_FORMATTER = DateFormatter.forPattern("strict_date_time"); @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_cat/indices", singletonList(GET)) - .put("/_cat/indices/{index}", singletonList(GET)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_cat/indices", GET), + new Route("/_cat/indices/{index}", GET))); } @Override @@ -240,7 +237,7 @@ public void onFailure(final Exception e) { private static final Set RESPONSE_PARAMS; static { - final Set responseParams = new HashSet<>(Arrays.asList("local", "health")); + final Set responseParams = new HashSet<>(asList("local", "health")); responseParams.addAll(AbstractCatAction.RESPONSE_PARAMS); RESPONSE_PARAMS = Collections.unmodifiableSet(responseParams); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestMasterAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestMasterAction.java index 68ba9c56e2864..b127f25cd68d3 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestMasterAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestMasterAction.java @@ -26,22 +26,19 @@ import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.common.Table; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestResponseListener; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestMasterAction extends AbstractCatAction { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_cat/master", singletonList(GET)); + public List handledRoutes() { + return singletonList(new Route("/_cat/master", GET)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodeAttrsAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodeAttrsAction.java index 616d202ff3053..71a39bef2ba40 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodeAttrsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodeAttrsAction.java @@ -30,7 +30,6 @@ import org.elasticsearch.common.Strings; import org.elasticsearch.common.Table; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestActionListener; import org.elasticsearch.rest.action.RestResponseListener; @@ -39,14 +38,13 @@ import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestNodeAttrsAction extends AbstractCatAction { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_cat/nodeattrs", singletonList(GET)); + public List handledRoutes() { + return singletonList(new Route("/_cat/nodeattrs", GET)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodesAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodesAction.java index 2bc8aab310d65..53230d97d6bd2 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodesAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodesAction.java @@ -55,7 +55,6 @@ import org.elasticsearch.monitor.os.OsStats; import org.elasticsearch.monitor.process.ProcessStats; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestActionListener; import org.elasticsearch.rest.action.RestResponseListener; @@ -64,18 +63,16 @@ import java.util.List; import java.util.Locale; -import java.util.Map; import java.util.stream.Collectors; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestNodesAction extends AbstractCatAction { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_cat/nodes", singletonList(GET)); + public List handledRoutes() { + return singletonList(new Route("/_cat/nodes", GET)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestPendingClusterTasksAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestPendingClusterTasksAction.java index 20e26833fda3f..cd78abcf37d8f 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestPendingClusterTasksAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestPendingClusterTasksAction.java @@ -25,22 +25,19 @@ import org.elasticsearch.cluster.service.PendingClusterTask; import org.elasticsearch.common.Table; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestResponseListener; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestPendingClusterTasksAction extends AbstractCatAction { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_cat/pending_tasks", singletonList(GET)); + public List handledRoutes() { + return singletonList(new Route("/_cat/pending_tasks", GET)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestPluginsAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestPluginsAction.java index 6b5a18b09c293..841e1e98390c4 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestPluginsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestPluginsAction.java @@ -30,23 +30,20 @@ import org.elasticsearch.common.Table; import org.elasticsearch.plugins.PluginInfo; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestActionListener; import org.elasticsearch.rest.action.RestResponseListener; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestPluginsAction extends AbstractCatAction { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_cat/plugins", singletonList(GET)); + public List handledRoutes() { + return singletonList(new Route("/_cat/plugins", GET)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestRepositoriesAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestRepositoriesAction.java index 746260e51c5ad..0e0dcfdfe5827 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestRepositoriesAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestRepositoriesAction.java @@ -25,15 +25,12 @@ import org.elasticsearch.cluster.metadata.RepositoryMetaData; import org.elasticsearch.common.Table; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestResponseListener; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; /** @@ -42,8 +39,8 @@ public class RestRepositoriesAction extends AbstractCatAction { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_cat/repositories", singletonList(GET)); + public List handledRoutes() { + return singletonList(new Route("/_cat/repositories", GET)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestSegmentsAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestSegmentsAction.java index 5536b1b66c07e..b604c6135e30b 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestSegmentsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestSegmentsAction.java @@ -30,29 +30,26 @@ import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.common.Strings; import org.elasticsearch.common.Table; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.index.engine.Segment; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestActionListener; import org.elasticsearch.rest.action.RestResponseListener; -import java.util.Collections; import java.util.List; import java.util.Map; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestSegmentsAction extends AbstractCatAction { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_cat/segments", singletonList(GET)) - .put("/_cat/segments/{index}", singletonList(GET)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_cat/segments", GET), + new Route("/_cat/segments/{index}", GET))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestShardsAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestShardsAction.java index 6cd8d02abb447..6f07cd7f14b2f 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestShardsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestShardsAction.java @@ -30,7 +30,6 @@ import org.elasticsearch.cluster.routing.UnassignedInfo; import org.elasticsearch.common.Strings; import org.elasticsearch.common.Table; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.index.cache.query.QueryCacheStats; import org.elasticsearch.index.engine.CommitStats; @@ -47,30 +46,26 @@ import org.elasticsearch.index.store.StoreStats; import org.elasticsearch.index.warmer.WarmerStats; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestActionListener; import org.elasticsearch.rest.action.RestResponseListener; import org.elasticsearch.search.suggest.completion.CompletionStats; import java.time.Instant; -import java.util.Collections; import java.util.List; import java.util.Locale; -import java.util.Map; import java.util.function.Function; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestShardsAction extends AbstractCatAction { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_cat/shards", singletonList(GET)) - .put("/_cat/shards/{index}", singletonList(GET)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList(new Route("/_cat/shards", GET), + new Route("/_cat/shards/{index}", GET))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestSnapshotAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestSnapshotAction.java index a881c027bbd1d..104b043fdcc16 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestSnapshotAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestSnapshotAction.java @@ -26,11 +26,9 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; import org.elasticsearch.common.Table; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.time.DateFormatter; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestResponseListener; import org.elasticsearch.snapshots.SnapshotInfo; @@ -38,12 +36,12 @@ import java.time.Instant; import java.time.ZoneOffset; -import java.util.Collections; import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; /** @@ -52,11 +50,10 @@ public class RestSnapshotAction extends AbstractCatAction { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_cat/snapshots", singletonList(GET)) - .put("/_cat/snapshots/{repository}", singletonList(GET)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_cat/snapshots", GET), + new Route("/_cat/snapshots/{repository}", GET))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestTasksAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestTasksAction.java index e635a496f7e18..b5115962ab40a 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestTasksAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestTasksAction.java @@ -29,7 +29,6 @@ import org.elasticsearch.common.time.DateFormatter; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestResponseListener; import org.elasticsearch.tasks.TaskInfo; @@ -41,12 +40,10 @@ import java.util.Comparator; import java.util.HashSet; import java.util.List; -import java.util.Map; import java.util.Set; import java.util.function.Supplier; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.action.admin.cluster.RestListTasksAction.generateListTasksRequest; @@ -58,8 +55,8 @@ public RestTasksAction(Supplier nodesInCluster) { } @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_cat/tasks", singletonList(GET)); + public List handledRoutes() { + return singletonList(new Route("/_cat/tasks", GET)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestTemplatesAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestTemplatesAction.java index d958e99bbd75e..044c8c78cc239 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestTemplatesAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestTemplatesAction.java @@ -26,28 +26,24 @@ import org.elasticsearch.cluster.metadata.IndexTemplateMetaData; import org.elasticsearch.cluster.metadata.MetaData; import org.elasticsearch.common.Table; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.regex.Regex; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestResponseListener; -import java.util.Collections; import java.util.List; -import java.util.Map; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestTemplatesAction extends AbstractCatAction { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_cat/templates", singletonList(GET)) - .put("/_cat/templates/{name}", singletonList(GET)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_cat/templates", GET), + new Route("/_cat/templates/{name}", GET))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestThreadPoolAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestThreadPoolAction.java index 606ed22bc1cb2..d9c63e264c9a4 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestThreadPoolAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestThreadPoolAction.java @@ -31,10 +31,8 @@ import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.common.Table; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.regex.Regex; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestActionListener; import org.elasticsearch.rest.action.RestResponseListener; @@ -49,17 +47,17 @@ import java.util.Set; import java.util.TreeMap; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestThreadPoolAction extends AbstractCatAction { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_cat/thread_pool", singletonList(GET)) - .put("/_cat/thread_pool/{thread_pool_patterns}", singletonList(GET)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_cat/thread_pool", GET), + new Route("/_cat/thread_pool/{thread_pool_patterns}", GET))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/document/RestBulkAction.java b/server/src/main/java/org/elasticsearch/rest/action/document/RestBulkAction.java index adb91d60e7eb7..79d2708096cbd 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/document/RestBulkAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/document/RestBulkAction.java @@ -24,18 +24,14 @@ import org.elasticsearch.action.support.ActiveShardCount; import org.elasticsearch.client.Requests; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestStatusToXContentListener; import org.elasticsearch.search.fetch.subphase.FetchSourceContext; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; import static java.util.Arrays.asList; import static java.util.Collections.unmodifiableList; @@ -60,11 +56,12 @@ public RestBulkAction(Settings settings) { } @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_bulk", unmodifiableList(asList(POST, PUT))) - .put("/{index}/_bulk", unmodifiableList(asList(POST, PUT))) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_bulk", POST), + new Route("/_bulk", PUT), + new Route("/{index}/_bulk", POST), + new Route("/{index}/_bulk", PUT))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/document/RestDeleteAction.java b/server/src/main/java/org/elasticsearch/rest/action/document/RestDeleteAction.java index 6942d9fe05693..4cd8796e80c9f 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/document/RestDeleteAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/document/RestDeleteAction.java @@ -25,23 +25,20 @@ import org.elasticsearch.index.VersionType; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestActions; import org.elasticsearch.rest.action.RestStatusToXContentListener; import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.DELETE; public class RestDeleteAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/{index}/_doc/{id}", singletonList(DELETE)); + public List handledRoutes() { + return singletonList(new Route("/{index}/_doc/{id}", DELETE)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/document/RestGetAction.java b/server/src/main/java/org/elasticsearch/rest/action/document/RestGetAction.java index 5252baa3af064..67a5927f99f62 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/document/RestGetAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/document/RestGetAction.java @@ -23,11 +23,9 @@ import org.elasticsearch.action.get.GetResponse; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.index.VersionType; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestActions; import org.elasticsearch.rest.action.RestToXContentListener; @@ -35,11 +33,9 @@ import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Arrays.asList; import static java.util.Collections.unmodifiableList; -import static java.util.Collections.unmodifiableMap; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.HEAD; import static org.elasticsearch.rest.RestStatus.NOT_FOUND; @@ -53,10 +49,10 @@ public String getName() { } @Override - public Map> handledMethodsAndPaths() { - return unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/{index}/_doc/{id}", unmodifiableList(asList(GET, HEAD))) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/{index}/_doc/{id}", GET), + new Route("/{index}/_doc/{id}", HEAD))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/document/RestGetSourceAction.java b/server/src/main/java/org/elasticsearch/rest/action/document/RestGetSourceAction.java index f974d7328a70d..59fbef33a6ddf 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/document/RestGetSourceAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/document/RestGetSourceAction.java @@ -31,7 +31,6 @@ import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestResponseListener; import org.elasticsearch.search.fetch.subphase.FetchSourceContext; @@ -39,10 +38,8 @@ import java.io.IOException; import java.io.InputStream; import java.util.List; -import java.util.Map; import static java.util.Arrays.asList; -import static java.util.Collections.singletonMap; import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.HEAD; @@ -54,8 +51,10 @@ public class RestGetSourceAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/{index}/_source/{id}", unmodifiableList(asList(GET, HEAD))); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/{index}/_source/{id}", GET), + new Route("/{index}/_source/{id}", HEAD))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/document/RestIndexAction.java b/server/src/main/java/org/elasticsearch/rest/action/document/RestIndexAction.java index a193afea2b37e..11128bcf2046d 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/document/RestIndexAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/document/RestIndexAction.java @@ -27,18 +27,15 @@ import org.elasticsearch.index.VersionType; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestActions; import org.elasticsearch.rest.action.RestStatusToXContentListener; import java.io.IOException; import java.util.List; import java.util.Locale; -import java.util.Map; import static java.util.Arrays.asList; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.RestRequest.Method.PUT; @@ -46,8 +43,10 @@ public class RestIndexAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/{index}/_doc/{id}", unmodifiableList(asList(POST, PUT))); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/{index}/_doc/{id}", POST), + new Route("/{index}/_doc/{id}", PUT))); } @Override @@ -63,8 +62,10 @@ public String getName() { } @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/{index}/_create/{id}", unmodifiableList(asList(POST, PUT))); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/{index}/_create/{id}", POST), + new Route("/{index}/_create/{id}", PUT))); } @Override @@ -95,8 +96,8 @@ public String getName() { } @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/{index}/_doc", singletonList(POST)); + public List handledRoutes() { + return singletonList(new Route("/{index}/_doc", POST)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/document/RestMultiGetAction.java b/server/src/main/java/org/elasticsearch/rest/action/document/RestMultiGetAction.java index 74c3749f32797..48fd1ac3d35d3 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/document/RestMultiGetAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/document/RestMultiGetAction.java @@ -22,19 +22,15 @@ import org.elasticsearch.action.get.MultiGetRequest; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.search.fetch.subphase.FetchSourceContext; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; import static java.util.Arrays.asList; import static java.util.Collections.unmodifiableList; @@ -50,11 +46,12 @@ public RestMultiGetAction(Settings settings) { } @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_mget", unmodifiableList(asList(GET, POST))) - .put("/{index}/_mget", unmodifiableList(asList(GET, POST))) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_mget", GET), + new Route("/_mget", POST), + new Route("/{index}/_mget", GET), + new Route("/{index}/_mget", POST))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/document/RestMultiTermVectorsAction.java b/server/src/main/java/org/elasticsearch/rest/action/document/RestMultiTermVectorsAction.java index d374f2fb553cc..0edf24547cebd 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/document/RestMultiTermVectorsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/document/RestMultiTermVectorsAction.java @@ -23,16 +23,12 @@ import org.elasticsearch.action.termvectors.TermVectorsRequest; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; import static java.util.Arrays.asList; import static java.util.Collections.unmodifiableList; @@ -42,11 +38,12 @@ public class RestMultiTermVectorsAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_mtermvectors", unmodifiableList(asList(GET, POST))) - .put("/{index}/_mtermvectors", unmodifiableList(asList(GET, POST))) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_mtermvectors", GET), + new Route("/_mtermvectors", POST), + new Route("/{index}/_mtermvectors", GET), + new Route("/{index}/_mtermvectors", POST))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/document/RestTermVectorsAction.java b/server/src/main/java/org/elasticsearch/rest/action/document/RestTermVectorsAction.java index 28cc5f66e4b22..566b988ec9266 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/document/RestTermVectorsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/document/RestTermVectorsAction.java @@ -22,20 +22,16 @@ import org.elasticsearch.action.termvectors.TermVectorsRequest; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.index.VersionType; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestActions; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; -import java.util.Collections; import java.util.HashSet; import java.util.List; -import java.util.Map; import java.util.Set; import static java.util.Arrays.asList; @@ -50,11 +46,12 @@ public class RestTermVectorsAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/{index}/_termvectors", unmodifiableList(asList(GET, POST))) - .put("/{index}/_termvectors/{id}", unmodifiableList(asList(GET, POST))) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/{index}/_termvectors", GET), + new Route("/{index}/_termvectors", POST), + new Route("/{index}/_termvectors/{id}", GET), + new Route("/{index}/_termvectors/{id}", POST))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/document/RestUpdateAction.java b/server/src/main/java/org/elasticsearch/rest/action/document/RestUpdateAction.java index bbba97aaf238d..de744f255cc8a 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/document/RestUpdateAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/document/RestUpdateAction.java @@ -27,24 +27,21 @@ import org.elasticsearch.index.VersionType; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestActions; import org.elasticsearch.rest.action.RestStatusToXContentListener; import org.elasticsearch.search.fetch.subphase.FetchSourceContext; import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestUpdateAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/{index}/_update/{id}", singletonList(POST)); + public List handledRoutes() { + return singletonList(new Route("/{index}/_update/{id}", POST)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/ingest/RestDeletePipelineAction.java b/server/src/main/java/org/elasticsearch/rest/action/ingest/RestDeletePipelineAction.java index b7d7b64893790..0849a9b4bd661 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/ingest/RestDeletePipelineAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/ingest/RestDeletePipelineAction.java @@ -23,21 +23,18 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.DELETE; public class RestDeletePipelineAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_ingest/pipeline/{id}", singletonList(DELETE)); + public List handledRoutes() { + return singletonList(new Route("/_ingest/pipeline/{id}", DELETE)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/ingest/RestGetPipelineAction.java b/server/src/main/java/org/elasticsearch/rest/action/ingest/RestGetPipelineAction.java index ac35a9d2a383b..e23af78a01c22 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/ingest/RestGetPipelineAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/ingest/RestGetPipelineAction.java @@ -22,28 +22,24 @@ import org.elasticsearch.action.ingest.GetPipelineRequest; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestStatusToXContentListener; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestGetPipelineAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_ingest/pipeline", singletonList(GET)) - .put("/_ingest/pipeline/{id}", singletonList(GET)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_ingest/pipeline", GET), + new Route("/_ingest/pipeline/{id}", GET))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/ingest/RestPutPipelineAction.java b/server/src/main/java/org/elasticsearch/rest/action/ingest/RestPutPipelineAction.java index d150a090bee35..ea4cd85c5c429 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/ingest/RestPutPipelineAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/ingest/RestPutPipelineAction.java @@ -26,23 +26,20 @@ import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.PUT; public class RestPutPipelineAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_ingest/pipeline/{id}", singletonList(PUT)); + public List handledRoutes() { + return singletonList(new Route("/_ingest/pipeline/{id}", PUT)); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/ingest/RestSimulatePipelineAction.java b/server/src/main/java/org/elasticsearch/rest/action/ingest/RestSimulatePipelineAction.java index 01a11658ab7f8..dfe5de212d38e 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/ingest/RestSimulatePipelineAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/ingest/RestSimulatePipelineAction.java @@ -22,18 +22,14 @@ import org.elasticsearch.action.ingest.SimulatePipelineRequest; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.bytes.BytesReference; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.collect.Tuple; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; import static java.util.Arrays.asList; import static java.util.Collections.unmodifiableList; @@ -43,11 +39,12 @@ public class RestSimulatePipelineAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_ingest/pipeline/{id}/_simulate", unmodifiableList(asList(GET, POST))) - .put("/_ingest/pipeline/_simulate", unmodifiableList(asList(GET, POST))) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_ingest/pipeline/{id}/_simulate", GET), + new Route("/_ingest/pipeline/{id}/_simulate", POST), + new Route("/_ingest/pipeline/_simulate", GET), + new Route("/_ingest/pipeline/_simulate", POST))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/search/RestClearScrollAction.java b/server/src/main/java/org/elasticsearch/rest/action/search/RestClearScrollAction.java index 901f333d2d27d..97a413c1584ef 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/search/RestClearScrollAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/search/RestClearScrollAction.java @@ -22,29 +22,24 @@ import org.elasticsearch.action.search.ClearScrollRequest; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestStatusToXContentListener; import java.io.IOException; -import java.util.Arrays; -import java.util.Collections; import java.util.List; -import java.util.Map; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.DELETE; public class RestClearScrollAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_search/scroll", singletonList(DELETE)) - .put("/_search/scroll/{scroll_id}", singletonList(DELETE)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_search/scroll", DELETE), + new Route("/_search/scroll/{scroll_id}", DELETE))); } @Override @@ -56,7 +51,7 @@ public String getName() { public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException { String scrollIds = request.param("scroll_id"); ClearScrollRequest clearRequest = new ClearScrollRequest(); - clearRequest.setScrollIds(Arrays.asList(Strings.splitStringByCommaToArray(scrollIds))); + clearRequest.setScrollIds(asList(Strings.splitStringByCommaToArray(scrollIds))); request.withContentOrSourceParamParserOrNull((xContentParser -> { if (xContentParser != null) { // NOTE: if rest request with xcontent body has request parameters, values parsed from request body have the precedence diff --git a/server/src/main/java/org/elasticsearch/rest/action/search/RestCountAction.java b/server/src/main/java/org/elasticsearch/rest/action/search/RestCountAction.java index 4971bd4171304..c1fe8edafc958 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/search/RestCountAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/search/RestCountAction.java @@ -24,22 +24,18 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestActions; import org.elasticsearch.rest.action.RestBuilderListener; import org.elasticsearch.search.builder.SearchSourceBuilder; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; import static java.util.Arrays.asList; import static java.util.Collections.unmodifiableList; @@ -51,11 +47,12 @@ public class RestCountAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_count", unmodifiableList(asList(GET, POST))) - .put("/{index}/_count", unmodifiableList(asList(GET, POST))) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_count", GET), + new Route("/_count", POST), + new Route("/{index}/_count", GET), + new Route("/{index}/_count", POST))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/search/RestExplainAction.java b/server/src/main/java/org/elasticsearch/rest/action/search/RestExplainAction.java index bff63b596d33b..5299a9fde31ce 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/search/RestExplainAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/search/RestExplainAction.java @@ -25,17 +25,14 @@ import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestActions; import org.elasticsearch.rest.action.RestStatusToXContentListener; import org.elasticsearch.search.fetch.subphase.FetchSourceContext; import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Arrays.asList; -import static java.util.Collections.singletonMap; import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -46,8 +43,10 @@ public class RestExplainAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/{index}/_explain/{id}", unmodifiableList(asList(GET, POST))); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/{index}/_explain/{id}", GET), + new Route("/{index}/_explain/{id}", POST))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/search/RestMultiSearchAction.java b/server/src/main/java/org/elasticsearch/rest/action/search/RestMultiSearchAction.java index 319ffba16a7f0..0e20ff4f0bb4a 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/search/RestMultiSearchAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/search/RestMultiSearchAction.java @@ -26,7 +26,6 @@ import org.elasticsearch.common.CheckedBiConsumer; import org.elasticsearch.common.Strings; import org.elasticsearch.common.bytes.BytesReference; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.collect.Tuple; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContent; @@ -34,7 +33,6 @@ import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.search.builder.SearchSourceBuilder; @@ -43,7 +41,6 @@ import java.util.Collections; import java.util.HashSet; import java.util.List; -import java.util.Map; import java.util.Set; import static java.util.Arrays.asList; @@ -69,11 +66,12 @@ public RestMultiSearchAction(Settings settings) { } @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_msearch", unmodifiableList(asList(GET, POST))) - .put("/{index}/_msearch", unmodifiableList(asList(GET, POST))) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_msearch", GET), + new Route("/_msearch", POST), + new Route("/{index}/_msearch", GET), + new Route("/{index}/_msearch", POST))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java b/server/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java index 1dde750859fae..c646fa36c3306 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java @@ -25,12 +25,10 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Booleans; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestActions; import org.elasticsearch.rest.action.RestCancellableNodeClient; import org.elasticsearch.rest.action.RestStatusToXContentListener; @@ -48,7 +46,6 @@ import java.util.Collections; import java.util.HashSet; import java.util.List; -import java.util.Map; import java.util.Set; import java.util.function.IntConsumer; @@ -79,11 +76,12 @@ public String getName() { } @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_search", unmodifiableList(asList(GET, POST))) - .put("/{index}/_search", unmodifiableList(asList(GET, POST))) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_search", GET), + new Route("/_search", POST), + new Route("/{index}/_search", GET), + new Route("/{index}/_search", POST))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/search/RestSearchScrollAction.java b/server/src/main/java/org/elasticsearch/rest/action/search/RestSearchScrollAction.java index ad12bd5f0a800..81e8561e14c00 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/search/RestSearchScrollAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/search/RestSearchScrollAction.java @@ -21,17 +21,14 @@ import org.elasticsearch.action.search.SearchScrollRequest; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestStatusToXContentListener; import org.elasticsearch.search.Scroll; import java.io.IOException; import java.util.Collections; import java.util.List; -import java.util.Map; import java.util.Set; import static java.util.Arrays.asList; @@ -49,11 +46,12 @@ public String getName() { } @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_search/scroll", unmodifiableList(asList(GET, POST))) - .put("/_search/scroll/{scroll_id}", unmodifiableList(asList(GET, POST))) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_search/scroll", GET), + new Route("/_search/scroll", POST), + new Route("/_search/scroll/{scroll_id}", GET), + new Route("/_search/scroll/{scroll_id}", POST))); } @Override diff --git a/server/src/test/java/org/elasticsearch/action/ActionModuleTests.java b/server/src/test/java/org/elasticsearch/action/ActionModuleTests.java index 189583f6de33b..247da38d09fc9 100644 --- a/server/src/test/java/org/elasticsearch/action/ActionModuleTests.java +++ b/server/src/test/java/org/elasticsearch/action/ActionModuleTests.java @@ -47,9 +47,7 @@ import org.elasticsearch.usage.UsageService; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; import java.util.function.Supplier; import static java.util.Collections.emptyList; @@ -121,8 +119,8 @@ public void handleRequest(RestRequest request, RestChannel channel, NodeClient c } @Override - public Map> handledMethodsAndPaths() { - return Collections.singletonMap("/", singletonList(Method.GET)); + public List handledRoutes() { + return singletonList(new Route("/", Method.GET)); } })); assertThat(e.getMessage(), startsWith("Cannot replace existing handler for [/] for method: GET")); @@ -154,8 +152,8 @@ public List getRestHandlers(Settings settings, RestController restC public void testPluginCanRegisterRestHandler() { class FakeHandler implements RestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.singletonMap("/_dummy", singletonList(Method.GET)); + public List handledRoutes() { + return singletonList(new Route("/_dummy", Method.GET)); } @Override @@ -187,8 +185,8 @@ public void handleRequest(RestRequest request, RestChannel channel, NodeClient c } @Override - public Map> handledMethodsAndPaths() { - return Collections.singletonMap("/_dummy", singletonList(Method.GET)); + public List handledRoutes() { + return singletonList(new Route("/_dummy", Method.GET)); } })); assertThat(e.getMessage(), startsWith("Cannot replace existing handler for [/_dummy] for method: GET")); diff --git a/server/src/test/java/org/elasticsearch/rest/BaseRestHandlerTests.java b/server/src/test/java/org/elasticsearch/rest/BaseRestHandlerTests.java index 7391aab78ee85..7f9ab8ac1c32b 100644 --- a/server/src/test/java/org/elasticsearch/rest/BaseRestHandlerTests.java +++ b/server/src/test/java/org/elasticsearch/rest/BaseRestHandlerTests.java @@ -25,7 +25,6 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.common.xcontent.json.JsonXContent; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.cat.AbstractCatAction; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.rest.FakeRestChannel; @@ -35,7 +34,6 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; -import java.util.Map; import java.util.Set; import java.util.concurrent.atomic.AtomicBoolean; @@ -60,8 +58,8 @@ public String getName() { } @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } }; @@ -91,8 +89,8 @@ public String getName() { } @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } }; @@ -132,8 +130,8 @@ public String getName() { } @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } }; @@ -180,8 +178,8 @@ public String getName() { } @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } }; @@ -208,8 +206,8 @@ public String getName() { } @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } }; @@ -248,8 +246,8 @@ public String getName() { } @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } }; @@ -283,8 +281,8 @@ public String getName() { } @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } }; @@ -312,8 +310,8 @@ public String getName() { } @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } }; @@ -337,8 +335,8 @@ public String getName() { } @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } }; diff --git a/server/src/test/java/org/elasticsearch/usage/UsageServiceTests.java b/server/src/test/java/org/elasticsearch/usage/UsageServiceTests.java index 1840617c29cad..845851b3e3516 100644 --- a/server/src/test/java/org/elasticsearch/usage/UsageServiceTests.java +++ b/server/src/test/java/org/elasticsearch/usage/UsageServiceTests.java @@ -26,7 +26,6 @@ import org.elasticsearch.common.transport.TransportAddress; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.rest.FakeRestRequest; @@ -104,8 +103,8 @@ public String getName() { } @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestCcrStatsAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestCcrStatsAction.java index 347bf15953f5f..7c41f5d7b2410 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestCcrStatsAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestCcrStatsAction.java @@ -9,22 +9,19 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ccr.action.CcrStatsAction; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestCcrStatsAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_ccr/stats", singletonList(GET)); + public List handledRoutes() { + return singletonList(new Route("/_ccr/stats", GET)); } @Override diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestDeleteAutoFollowPatternAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestDeleteAutoFollowPatternAction.java index c859a67053303..5519f281fa6d1 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestDeleteAutoFollowPatternAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestDeleteAutoFollowPatternAction.java @@ -8,23 +8,20 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ccr.action.DeleteAutoFollowPatternAction.Request; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.DELETE; import static org.elasticsearch.xpack.core.ccr.action.DeleteAutoFollowPatternAction.INSTANCE; public class RestDeleteAutoFollowPatternAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_ccr/auto_follow/{name}", singletonList(DELETE)); + public List handledRoutes() { + return singletonList(new Route("/_ccr/auto_follow/{name}", DELETE)); } @Override diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestFollowInfoAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestFollowInfoAction.java index f4aed8ab46998..ebad7c2e7016b 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestFollowInfoAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestFollowInfoAction.java @@ -10,22 +10,19 @@ import org.elasticsearch.common.Strings; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ccr.action.FollowInfoAction; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestFollowInfoAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/{index}/_ccr/info", singletonList(GET)); + public List handledRoutes() { + return singletonList(new Route("/{index}/_ccr/info", GET)); } @Override diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestFollowStatsAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestFollowStatsAction.java index 64fce4cb87a06..26bc2edc220bc 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestFollowStatsAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestFollowStatsAction.java @@ -10,22 +10,19 @@ import org.elasticsearch.common.Strings; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ccr.action.FollowStatsAction; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestFollowStatsAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/{index}/_ccr/stats", singletonList(GET)); + public List handledRoutes() { + return singletonList(new Route("/{index}/_ccr/stats", GET)); } @Override diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestForgetFollowerAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestForgetFollowerAction.java index 19592ccb4008a..20eed34c6f3de 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestForgetFollowerAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestForgetFollowerAction.java @@ -10,24 +10,21 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ccr.action.ForgetFollowerAction; import org.elasticsearch.xpack.core.ccr.action.ForgetFollowerAction.Request; import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestForgetFollowerAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/{index}/_ccr/forget_follower", singletonList(POST)); + public List handledRoutes() { + return singletonList(new Route("/{index}/_ccr/forget_follower", POST)); } @Override diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestGetAutoFollowPatternAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestGetAutoFollowPatternAction.java index 4acf39a277513..67e5c8b1b49d5 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestGetAutoFollowPatternAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestGetAutoFollowPatternAction.java @@ -6,29 +6,25 @@ package org.elasticsearch.xpack.ccr.rest; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ccr.action.GetAutoFollowPatternAction.Request; -import java.util.Collections; import java.util.List; -import java.util.Map; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.xpack.core.ccr.action.GetAutoFollowPatternAction.INSTANCE; public class RestGetAutoFollowPatternAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_ccr/auto_follow/{name}", singletonList(GET)) - .put("/_ccr/auto_follow", singletonList(GET)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_ccr/auto_follow/{name}", GET), + new Route("/_ccr/auto_follow", GET))); } @Override diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPauseAutoFollowPatternAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPauseAutoFollowPatternAction.java index 6bc5242cc6874..a1adb12ad6c57 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPauseAutoFollowPatternAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPauseAutoFollowPatternAction.java @@ -8,23 +8,20 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ccr.action.ActivateAutoFollowPatternAction.Request; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.xpack.core.ccr.action.ActivateAutoFollowPatternAction.INSTANCE; public class RestPauseAutoFollowPatternAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_ccr/auto_follow/{name}/pause", singletonList(POST)); + public List handledRoutes() { + return singletonList(new Route("/_ccr/auto_follow/{name}/pause", POST)); } @Override diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPauseFollowAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPauseFollowAction.java index addbeac53a0d7..7cee2e1320170 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPauseFollowAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPauseFollowAction.java @@ -8,14 +8,11 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.xpack.core.ccr.action.PauseFollowAction.INSTANCE; import static org.elasticsearch.xpack.core.ccr.action.PauseFollowAction.Request; @@ -23,8 +20,8 @@ public class RestPauseFollowAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/{index}/_ccr/pause_follow", singletonList(POST)); + public List handledRoutes() { + return singletonList(new Route("/{index}/_ccr/pause_follow", POST)); } @Override diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPutAutoFollowPatternAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPutAutoFollowPatternAction.java index 944cd1232ecd2..e4ec9887607f5 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPutAutoFollowPatternAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPutAutoFollowPatternAction.java @@ -9,24 +9,21 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ccr.action.PutAutoFollowPatternAction.Request; import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.PUT; import static org.elasticsearch.xpack.core.ccr.action.PutAutoFollowPatternAction.INSTANCE; public class RestPutAutoFollowPatternAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_ccr/auto_follow/{name}", singletonList(PUT)); + public List handledRoutes() { + return singletonList(new Route("/_ccr/auto_follow/{name}", PUT)); } @Override diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPutFollowAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPutFollowAction.java index c02f7f5926cbd..86b90ca9ab97e 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPutFollowAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPutFollowAction.java @@ -10,15 +10,12 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.PUT; import static org.elasticsearch.xpack.core.ccr.action.PutFollowAction.INSTANCE; import static org.elasticsearch.xpack.core.ccr.action.PutFollowAction.Request; @@ -26,8 +23,8 @@ public class RestPutFollowAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/{index}/_ccr/follow", singletonList(PUT)); + public List handledRoutes() { + return singletonList(new Route("/{index}/_ccr/follow", PUT)); } @Override diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestResumeAutoFollowPatternAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestResumeAutoFollowPatternAction.java index 0cf5f4357e60a..a31660bbd1172 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestResumeAutoFollowPatternAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestResumeAutoFollowPatternAction.java @@ -8,23 +8,20 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ccr.action.ActivateAutoFollowPatternAction.Request; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.xpack.core.ccr.action.ActivateAutoFollowPatternAction.INSTANCE; public class RestResumeAutoFollowPatternAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_ccr/auto_follow/{name}/resume", singletonList(POST)); + public List handledRoutes() { + return singletonList(new Route("/_ccr/auto_follow/{name}/resume", POST)); } @Override diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestResumeFollowAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestResumeFollowAction.java index 44408b37bde92..8a3f05636dba6 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestResumeFollowAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestResumeFollowAction.java @@ -9,15 +9,12 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.xpack.core.ccr.action.ResumeFollowAction.INSTANCE; import static org.elasticsearch.xpack.core.ccr.action.ResumeFollowAction.Request; @@ -25,8 +22,8 @@ public class RestResumeFollowAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/{index}/_ccr/resume_follow", singletonList(POST)); + public List handledRoutes() { + return singletonList(new Route("/{index}/_ccr/resume_follow", POST)); } @Override diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestUnfollowAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestUnfollowAction.java index af2915f7edcbf..e3498d70a01ba 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestUnfollowAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestUnfollowAction.java @@ -9,23 +9,20 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ccr.action.UnfollowAction; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.xpack.core.ccr.action.UnfollowAction.INSTANCE; public class RestUnfollowAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/{index}/_ccr/unfollow", singletonList(POST)); + public List handledRoutes() { + return singletonList(new Route("/{index}/_ccr/unfollow", POST)); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestDeleteLicenseAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestDeleteLicenseAction.java index fe3a8b3171549..58351c3704793 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestDeleteLicenseAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestDeleteLicenseAction.java @@ -10,15 +10,12 @@ import org.elasticsearch.protocol.xpack.license.DeleteLicenseRequest; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.DELETE; public class RestDeleteLicenseAction extends BaseRestHandler { @@ -26,8 +23,8 @@ public class RestDeleteLicenseAction extends BaseRestHandler { RestDeleteLicenseAction() {} @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_license", singletonList(DELETE)); + public List handledRoutes() { + return singletonList(new Route("/_license", DELETE)); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetBasicStatus.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetBasicStatus.java index b8d5f34202dd5..ddafdca84a6ba 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetBasicStatus.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetBasicStatus.java @@ -9,14 +9,11 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestGetBasicStatus extends BaseRestHandler { @@ -24,8 +21,8 @@ public class RestGetBasicStatus extends BaseRestHandler { RestGetBasicStatus() {} @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_license/basic_status", singletonList(GET)); + public List handledRoutes() { + return singletonList(new Route("/_license/basic_status", GET)); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetLicenseAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetLicenseAction.java index 5802ab0416496..edba7c14729ae 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetLicenseAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetLicenseAction.java @@ -15,7 +15,6 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestBuilderListener; @@ -25,7 +24,6 @@ import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestStatus.NOT_FOUND; import static org.elasticsearch.rest.RestStatus.OK; @@ -37,8 +35,8 @@ public class RestGetLicenseAction extends BaseRestHandler { RestGetLicenseAction() {} @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_license", singletonList(GET)); + public List handledRoutes() { + return singletonList(new Route("/_license", GET)); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetTrialStatus.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetTrialStatus.java index e7c990a87cb7c..bd0584ae39285 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetTrialStatus.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetTrialStatus.java @@ -9,14 +9,11 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestGetTrialStatus extends BaseRestHandler { @@ -24,8 +21,8 @@ public class RestGetTrialStatus extends BaseRestHandler { RestGetTrialStatus() {} @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_license/trial_status", singletonList(GET)); + public List handledRoutes() { + return singletonList(new Route("/_license/trial_status", GET)); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPostStartBasicLicense.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPostStartBasicLicense.java index 4fd7a22d4688a..40d58a215ff2c 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPostStartBasicLicense.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPostStartBasicLicense.java @@ -9,15 +9,12 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestStatusToXContentListener; import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestPostStartBasicLicense extends BaseRestHandler { @@ -25,8 +22,8 @@ public class RestPostStartBasicLicense extends BaseRestHandler { RestPostStartBasicLicense() {} @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_license/start_basic", singletonList(POST)); + public List handledRoutes() { + return singletonList(new Route("/_license/start_basic", POST)); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPostStartTrialLicense.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPostStartTrialLicense.java index ea9f843735e52..7753acd330686 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPostStartTrialLicense.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPostStartTrialLicense.java @@ -11,7 +11,6 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestBuilderListener; @@ -20,7 +19,6 @@ import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestPostStartTrialLicense extends BaseRestHandler { @@ -28,8 +26,8 @@ public class RestPostStartTrialLicense extends BaseRestHandler { RestPostStartTrialLicense() {} @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_license/start_trial", singletonList(POST)); + public List handledRoutes() { + return singletonList(new Route("/_license/start_trial", POST)); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPutLicenseAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPutLicenseAction.java index 98ff2d3478eb4..21827743bc563 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPutLicenseAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPutLicenseAction.java @@ -9,15 +9,12 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Arrays.asList; -import static java.util.Collections.singletonMap; import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.RestRequest.Method.PUT; @@ -27,9 +24,11 @@ public class RestPutLicenseAction extends BaseRestHandler { RestPutLicenseAction() {} @Override - public Map> handledMethodsAndPaths() { + public List handledRoutes() { // TODO: remove POST endpoint? - return singletonMap("/_license", unmodifiableList(asList(POST, PUT))); + return unmodifiableList(asList( + new Route("/_license", POST), + new Route("/_license", PUT))); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rest/action/RestReloadAnalyzersAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rest/action/RestReloadAnalyzersAction.java index 0d058293ce900..04c74e354b8b0 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rest/action/RestReloadAnalyzersAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rest/action/RestReloadAnalyzersAction.java @@ -10,17 +10,14 @@ import org.elasticsearch.common.Strings; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.action.ReloadAnalyzerAction; import org.elasticsearch.xpack.core.action.ReloadAnalyzersRequest; import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Arrays.asList; -import static java.util.Collections.singletonMap; import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -28,8 +25,10 @@ public class RestReloadAnalyzersAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/{index}/_reload_search_analyzers", unmodifiableList(asList(GET, POST))); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/{index}/_reload_search_analyzers", GET), + new Route("/{index}/_reload_search_analyzers", POST))); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rest/action/RestXPackInfoAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rest/action/RestXPackInfoAction.java index 1080b64e84aca..0ea34bc6ae43c 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rest/action/RestXPackInfoAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rest/action/RestXPackInfoAction.java @@ -9,17 +9,14 @@ import org.elasticsearch.protocol.xpack.XPackInfoRequest; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.action.XPackInfoRequestBuilder; import java.io.IOException; import java.util.EnumSet; import java.util.List; -import java.util.Map; import static java.util.Arrays.asList; -import static java.util.Collections.singletonMap; import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.HEAD; @@ -27,8 +24,10 @@ public class RestXPackInfoAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_xpack", unmodifiableList(asList(GET, HEAD))); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_xpack", GET), + new Route("/_xpack", HEAD))); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rest/action/RestXPackUsageAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rest/action/RestXPackUsageAction.java index 843ccbfd4a02f..4b89d4789583c 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rest/action/RestXPackUsageAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rest/action/RestXPackUsageAction.java @@ -12,7 +12,6 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestBuilderListener; import org.elasticsearch.xpack.core.XPackFeatureSet; @@ -21,18 +20,16 @@ import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestStatus.OK; public class RestXPackUsageAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_xpack/usage", singletonList(GET)); + public List handledRoutes() { + return singletonList(new Route("/_xpack/usage", GET)); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/rest/RestGetCertificateInfoAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/rest/RestGetCertificateInfoAction.java index f2ebca3624703..e5efc7f17010d 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/rest/RestGetCertificateInfoAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/rest/RestGetCertificateInfoAction.java @@ -10,7 +10,6 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -18,10 +17,8 @@ import org.elasticsearch.xpack.core.ssl.action.GetCertificateInfoAction.Response; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; /** @@ -31,8 +28,8 @@ public class RestGetCertificateInfoAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_ssl/certificates", singletonList(GET)); + public List handledRoutes() { + return singletonList(new Route("/_ssl/certificates", GET)); } @Override diff --git a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/RestDeprecationInfoAction.java b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/RestDeprecationInfoAction.java index 773e9cd0a36bf..dd8a4757f40dd 100644 --- a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/RestDeprecationInfoAction.java +++ b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/RestDeprecationInfoAction.java @@ -7,30 +7,26 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.deprecation.DeprecationInfoAction; import org.elasticsearch.xpack.core.deprecation.DeprecationInfoAction.Request; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestDeprecationInfoAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_migration/deprecations", singletonList(GET)) - .put("/{index}/_migration/deprecations", singletonList(GET)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_migration/deprecations", GET), + new Route("/{index}/_migration/deprecations", GET))); } @Override diff --git a/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestDeleteEnrichPolicyAction.java b/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestDeleteEnrichPolicyAction.java index ec965be099cd8..cc42d96763944 100644 --- a/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestDeleteEnrichPolicyAction.java +++ b/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestDeleteEnrichPolicyAction.java @@ -8,23 +8,20 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.enrich.action.DeleteEnrichPolicyAction; import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.DELETE; public class RestDeleteEnrichPolicyAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_enrich/policy/{name}", singletonList(DELETE)); + public List handledRoutes() { + return singletonList(new Route("/_enrich/policy/{name}", DELETE)); } @Override diff --git a/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestEnrichStatsAction.java b/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestEnrichStatsAction.java index e103a6d9cd92e..01ac4eb751e58 100644 --- a/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestEnrichStatsAction.java +++ b/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestEnrichStatsAction.java @@ -8,23 +8,20 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.enrich.action.EnrichStatsAction; import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestEnrichStatsAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_enrich/_stats", singletonList(GET)); + public List handledRoutes() { + return singletonList(new Route("/_enrich/_stats", GET)); } @Override diff --git a/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestExecuteEnrichPolicyAction.java b/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestExecuteEnrichPolicyAction.java index ee1ed9f4296c4..63066d1b56bf7 100644 --- a/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestExecuteEnrichPolicyAction.java +++ b/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestExecuteEnrichPolicyAction.java @@ -8,16 +8,13 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.enrich.action.ExecuteEnrichPolicyAction; import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Arrays.asList; -import static java.util.Collections.singletonMap; import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.RestRequest.Method.PUT; @@ -25,8 +22,10 @@ public class RestExecuteEnrichPolicyAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_enrich/policy/{name}/_execute", unmodifiableList(asList(POST, PUT))); + public List handledRoutes() { + return unmodifiableList( + asList(new Route("/_enrich/policy/{name}/_execute", POST), new Route("/_enrich/policy/{name}/_execute", PUT)) + ); } @Override diff --git a/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestGetEnrichPolicyAction.java b/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestGetEnrichPolicyAction.java index 3be0d2f3f4505..c2f5ca9fd6adf 100644 --- a/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestGetEnrichPolicyAction.java +++ b/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestGetEnrichPolicyAction.java @@ -7,31 +7,23 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.enrich.action.GetEnrichPolicyAction; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestGetEnrichPolicyAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap( - MapBuilder.>newMapBuilder() - .put("/_enrich/policy/{name}", singletonList(GET)) - .put("/_enrich/policy", singletonList(GET)) - .map() - ); + public List handledRoutes() { + return unmodifiableList(asList(new Route("/_enrich/policy/{name}", GET), new Route("/_enrich/policy", GET))); } @Override diff --git a/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestPutEnrichPolicyAction.java b/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestPutEnrichPolicyAction.java index 84685771a35cf..c2d2c3dce61c6 100644 --- a/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestPutEnrichPolicyAction.java +++ b/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestPutEnrichPolicyAction.java @@ -9,23 +9,20 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.enrich.action.PutEnrichPolicyAction; import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.PUT; public class RestPutEnrichPolicyAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_enrich/policy/{name}", singletonList(PUT)); + public List handledRoutes() { + return singletonList(new Route("/_enrich/policy/{name}", PUT)); } @Override diff --git a/x-pack/plugin/eql/src/main/java/org/elasticsearch/xpack/eql/plugin/RestEqlSearchAction.java b/x-pack/plugin/eql/src/main/java/org/elasticsearch/xpack/eql/plugin/RestEqlSearchAction.java index 8938462bfb046..2091bc21365f0 100644 --- a/x-pack/plugin/eql/src/main/java/org/elasticsearch/xpack/eql/plugin/RestEqlSearchAction.java +++ b/x-pack/plugin/eql/src/main/java/org/elasticsearch/xpack/eql/plugin/RestEqlSearchAction.java @@ -13,7 +13,6 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestResponseListener; @@ -23,10 +22,8 @@ import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Arrays.asList; -import static java.util.Collections.singletonMap; import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -35,8 +32,10 @@ public class RestEqlSearchAction extends BaseRestHandler { private static final String SEARCH_PATH = "/{index}/_eql/search"; @Override - public Map> handledMethodsAndPaths() { - return singletonMap(SEARCH_PATH, unmodifiableList(asList(GET, POST))); + public List handledRoutes() { + return unmodifiableList(asList( + new Route(SEARCH_PATH, GET), + new Route(SEARCH_PATH, POST))); } @Override diff --git a/x-pack/plugin/frozen-indices/src/main/java/org/elasticsearch/xpack/frozen/rest/action/RestFreezeIndexAction.java b/x-pack/plugin/frozen-indices/src/main/java/org/elasticsearch/xpack/frozen/rest/action/RestFreezeIndexAction.java index 595dddaa96adc..558df47869290 100644 --- a/x-pack/plugin/frozen-indices/src/main/java/org/elasticsearch/xpack/frozen/rest/action/RestFreezeIndexAction.java +++ b/x-pack/plugin/frozen-indices/src/main/java/org/elasticsearch/xpack/frozen/rest/action/RestFreezeIndexAction.java @@ -9,29 +9,25 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.protocol.xpack.frozen.FreezeRequest; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.frozen.action.FreezeIndexAction; -import java.util.Collections; import java.util.List; -import java.util.Map; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.POST; public final class RestFreezeIndexAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/{index}/_freeze", singletonList(POST)) - .put("/{index}/_unfreeze", singletonList(POST)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/{index}/_freeze", POST), + new Route("/{index}/_unfreeze", POST))); } @Override diff --git a/x-pack/plugin/graph/src/main/java/org/elasticsearch/xpack/graph/rest/action/RestGraphAction.java b/x-pack/plugin/graph/src/main/java/org/elasticsearch/xpack/graph/rest/action/RestGraphAction.java index 62a204656fcc1..b4dd46c404507 100644 --- a/x-pack/plugin/graph/src/main/java/org/elasticsearch/xpack/graph/rest/action/RestGraphAction.java +++ b/x-pack/plugin/graph/src/main/java/org/elasticsearch/xpack/graph/rest/action/RestGraphAction.java @@ -19,7 +19,6 @@ import org.elasticsearch.protocol.xpack.graph.VertexRequest; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; @@ -29,7 +28,6 @@ import java.util.Map; import static java.util.Arrays.asList; -import static java.util.Collections.singletonMap; import static java.util.Collections.unmodifiableList; import static org.elasticsearch.index.query.AbstractQueryBuilder.parseInnerQueryBuilder; import static org.elasticsearch.rest.RestRequest.Method.GET; @@ -61,8 +59,10 @@ public class RestGraphAction extends BaseRestHandler { public static final ParseField TERM_FIELD = new ParseField("term"); @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/{index}/_graph/explore", unmodifiableList(asList(GET, POST))); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/{index}/_graph/explore", GET), + new Route("/{index}/_graph/explore", POST))); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestDeleteLifecycleAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestDeleteLifecycleAction.java index 381328d849ba3..5602686d44af7 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestDeleteLifecycleAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestDeleteLifecycleAction.java @@ -9,22 +9,19 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ilm.action.DeleteLifecycleAction; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.DELETE; public class RestDeleteLifecycleAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_ilm/policy/{name}", singletonList(DELETE)); + public List handledRoutes() { + return singletonList(new Route("/_ilm/policy/{name}", DELETE)); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestExplainLifecycleAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestExplainLifecycleAction.java index 7999ec706f47a..da838842b6b88 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestExplainLifecycleAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestExplainLifecycleAction.java @@ -11,23 +11,20 @@ import org.elasticsearch.common.Strings; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ilm.ExplainLifecycleRequest; import org.elasticsearch.xpack.core.ilm.action.ExplainLifecycleAction; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestExplainLifecycleAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/{index}/_ilm/explain", singletonList(GET)); + public List handledRoutes() { + return singletonList(new Route("/{index}/_ilm/explain", GET)); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestGetLifecycleAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestGetLifecycleAction.java index e76c16c69e507..333e90cc53ce0 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestGetLifecycleAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestGetLifecycleAction.java @@ -8,28 +8,24 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ilm.action.GetLifecycleAction; -import java.util.Collections; import java.util.List; -import java.util.Map; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestGetLifecycleAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_ilm/policy", singletonList(GET)) - .put("/_ilm/policy/{name}", singletonList(GET)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_ilm/policy", GET), + new Route("/_ilm/policy/{name}", GET))); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestGetStatusAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestGetStatusAction.java index 4334238fff9b0..41b92b5ae608a 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestGetStatusAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestGetStatusAction.java @@ -9,22 +9,19 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ilm.action.GetStatusAction; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestGetStatusAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_ilm/status", singletonList(GET)); + public List handledRoutes() { + return singletonList(new Route("/_ilm/status", GET)); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestMoveToStepAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestMoveToStepAction.java index 5a10e792fa167..6ffc34f84bbae 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestMoveToStepAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestMoveToStepAction.java @@ -11,23 +11,20 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ilm.action.MoveToStepAction; import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestMoveToStepAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_ilm/move/{name}", singletonList(POST)); + public List handledRoutes() { + return singletonList(new Route("/_ilm/move/{name}", POST)); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestPutLifecycleAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestPutLifecycleAction.java index 881cfe0662d45..1181e99bd7edf 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestPutLifecycleAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestPutLifecycleAction.java @@ -10,23 +10,20 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ilm.action.PutLifecycleAction; import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.PUT; public class RestPutLifecycleAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_ilm/policy/{name}", singletonList(PUT)); + public List handledRoutes() { + return singletonList(new Route("/_ilm/policy/{name}", PUT)); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestRemoveIndexLifecyclePolicyAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestRemoveIndexLifecyclePolicyAction.java index e08b8b03d56dc..27b0dea7b4a8b 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestRemoveIndexLifecyclePolicyAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestRemoveIndexLifecyclePolicyAction.java @@ -11,22 +11,19 @@ import org.elasticsearch.common.Strings; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ilm.action.RemoveIndexLifecyclePolicyAction; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestRemoveIndexLifecyclePolicyAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/{index}/_ilm/remove", singletonList(POST)); + public List handledRoutes() { + return singletonList(new Route("/{index}/_ilm/remove", POST)); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestRetryAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestRetryAction.java index 56c734b5d8990..55ce43f3283b2 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestRetryAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestRetryAction.java @@ -12,22 +12,19 @@ import org.elasticsearch.common.Strings; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ilm.action.RetryAction; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestRetryAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/{index}/_ilm/retry", singletonList(POST)); + public List handledRoutes() { + return singletonList(new Route("/{index}/_ilm/retry", POST)); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestStartILMAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestStartILMAction.java index b4dcbd795829f..bed7a4fae38f2 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestStartILMAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestStartILMAction.java @@ -9,23 +9,20 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ilm.StartILMRequest; import org.elasticsearch.xpack.core.ilm.action.StartILMAction; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestStartILMAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_ilm/start", singletonList(POST)); + public List handledRoutes() { + return singletonList(new Route("/_ilm/start", POST)); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestStopAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestStopAction.java index 39908494c5e1c..fe5f12d40fb55 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestStopAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestStopAction.java @@ -9,23 +9,20 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ilm.StopILMRequest; import org.elasticsearch.xpack.core.ilm.action.StopILMAction; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestStopAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_ilm/stop", singletonList(POST)); + public List handledRoutes() { + return singletonList(new Route("/_ilm/stop", POST)); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestDeleteSnapshotLifecycleAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestDeleteSnapshotLifecycleAction.java index 912387d51a251..c2cb848f7615c 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestDeleteSnapshotLifecycleAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestDeleteSnapshotLifecycleAction.java @@ -9,22 +9,19 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.slm.action.DeleteSnapshotLifecycleAction; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.DELETE; public class RestDeleteSnapshotLifecycleAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_slm/policy/{name}", singletonList(DELETE)); + public List handledRoutes() { + return singletonList(new Route("/_slm/policy/{name}", DELETE)); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestExecuteSnapshotLifecycleAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestExecuteSnapshotLifecycleAction.java index e53ea12ae113e..e5f6bd7e9355b 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestExecuteSnapshotLifecycleAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestExecuteSnapshotLifecycleAction.java @@ -9,15 +9,12 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.slm.action.ExecuteSnapshotLifecycleAction; import java.util.List; -import java.util.Map; import static java.util.Arrays.asList; -import static java.util.Collections.singletonMap; import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.RestRequest.Method.PUT; @@ -25,8 +22,10 @@ public class RestExecuteSnapshotLifecycleAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_slm/policy/{name}/_execute", unmodifiableList(asList(POST, PUT))); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_slm/policy/{name}/_execute", POST), + new Route("/_slm/policy/{name}/_execute", PUT))); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestExecuteSnapshotRetentionAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestExecuteSnapshotRetentionAction.java index 5ba20e7f637ba..1acb00c2b0574 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestExecuteSnapshotRetentionAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestExecuteSnapshotRetentionAction.java @@ -9,22 +9,19 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.slm.action.ExecuteSnapshotRetentionAction; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestExecuteSnapshotRetentionAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_slm/_execute_retention", singletonList(POST)); + public List handledRoutes() { + return singletonList(new Route("/_slm/_execute_retention", POST)); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestGetSLMStatusAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestGetSLMStatusAction.java index 91048f7b3fde3..32c99b3e57a67 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestGetSLMStatusAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestGetSLMStatusAction.java @@ -9,22 +9,19 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.slm.action.GetSLMStatusAction; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestGetSLMStatusAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_slm/status", singletonList(GET)); + public List handledRoutes() { + return singletonList(new Route("/_slm/status", GET)); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestGetSnapshotLifecycleAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestGetSnapshotLifecycleAction.java index b38a346ce3d14..ab7325083fee8 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestGetSnapshotLifecycleAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestGetSnapshotLifecycleAction.java @@ -8,28 +8,24 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.slm.action.GetSnapshotLifecycleAction; -import java.util.Collections; import java.util.List; -import java.util.Map; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestGetSnapshotLifecycleAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_slm/policy", singletonList(GET)) - .put("/_slm/policy/{name}", singletonList(GET)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_slm/policy", GET), + new Route("/_slm/policy/{name}", GET))); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestGetSnapshotLifecycleStatsAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestGetSnapshotLifecycleStatsAction.java index ab530e81e54ef..bd1506fd5152f 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestGetSnapshotLifecycleStatsAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestGetSnapshotLifecycleStatsAction.java @@ -9,22 +9,19 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.slm.action.GetSnapshotLifecycleStatsAction; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestGetSnapshotLifecycleStatsAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_slm/stats", singletonList(GET)); + public List handledRoutes() { + return singletonList(new Route("/_slm/stats", GET)); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestPutSnapshotLifecycleAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestPutSnapshotLifecycleAction.java index 392bb6caa1da4..dcf649324992e 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestPutSnapshotLifecycleAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestPutSnapshotLifecycleAction.java @@ -10,23 +10,20 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.slm.action.PutSnapshotLifecycleAction; import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.PUT; public class RestPutSnapshotLifecycleAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_slm/policy/{name}", singletonList(PUT)); + public List handledRoutes() { + return singletonList(new Route("/_slm/policy/{name}", PUT)); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestStartSLMAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestStartSLMAction.java index ea737bcd784a0..5d3f77f654732 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestStartSLMAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestStartSLMAction.java @@ -9,22 +9,19 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.slm.action.StartSLMAction; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestStartSLMAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_slm/start", singletonList(POST)); + public List handledRoutes() { + return singletonList(new Route("/_slm/start", POST)); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestStopSLMAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestStopSLMAction.java index d52776fb6f730..d09e33821e771 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestStopSLMAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestStopSLMAction.java @@ -9,22 +9,19 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.slm.action.StopSLMAction; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestStopSLMAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_slm/stop", singletonList(POST)); + public List handledRoutes() { + return singletonList(new Route("/_slm/stop", POST)); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestDeleteExpiredDataAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestDeleteExpiredDataAction.java index 21219ba17169f..ccb49fe564fb1 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestDeleteExpiredDataAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestDeleteExpiredDataAction.java @@ -10,7 +10,6 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.DeleteExpiredDataAction; import org.elasticsearch.xpack.ml.MachineLearning; @@ -18,7 +17,6 @@ import java.io.IOException; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.DELETE; @@ -28,15 +26,15 @@ public class RestDeleteExpiredDataAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestDeleteExpiredDataAction.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.singletonList( - new ReplacedRestApi(DELETE, MachineLearning.BASE_PATH + "_delete_expired_data", + new ReplacedRoute(DELETE, MachineLearning.BASE_PATH + "_delete_expired_data", DELETE, MachineLearning.PRE_V7_BASE_PATH + "_delete_expired_data", deprecationLogger) ); diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestFindFileStructureAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestFindFileStructureAction.java index e7e528b450b5a..6aa6a9c95eeb6 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestFindFileStructureAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestFindFileStructureAction.java @@ -12,7 +12,6 @@ import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.FindFileStructureAction; import org.elasticsearch.xpack.core.ml.filestructurefinder.FileStructure; @@ -22,7 +21,6 @@ import java.io.IOException; import java.util.Collections; import java.util.List; -import java.util.Map; import java.util.Set; import java.util.concurrent.TimeUnit; @@ -36,15 +34,15 @@ public class RestFindFileStructureAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestFindFileStructureAction.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.singletonList( - new ReplacedRestApi(POST, MachineLearning.BASE_PATH + "find_file_structure", + new ReplacedRoute(POST, MachineLearning.BASE_PATH + "find_file_structure", POST, MachineLearning.PRE_V7_BASE_PATH + "find_file_structure", deprecationLogger) ); diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestMlInfoAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestMlInfoAction.java index 7f4c17340cf54..8f1704eabae30 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestMlInfoAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestMlInfoAction.java @@ -10,7 +10,6 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.MlInfoAction; import org.elasticsearch.xpack.ml.MachineLearning; @@ -18,7 +17,6 @@ import java.io.IOException; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.GET; @@ -28,15 +26,15 @@ public class RestMlInfoAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestMlInfoAction.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.singletonList( - new ReplacedRestApi(GET, MachineLearning.BASE_PATH + "info", + new ReplacedRoute(GET, MachineLearning.BASE_PATH + "info", GET, MachineLearning.PRE_V7_BASE_PATH + "info", deprecationLogger) ); diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestSetUpgradeModeAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestSetUpgradeModeAction.java index cb90b30f8b365..fc74b37debb6a 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestSetUpgradeModeAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestSetUpgradeModeAction.java @@ -10,7 +10,6 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.SetUpgradeModeAction; import org.elasticsearch.xpack.ml.MachineLearning; @@ -18,7 +17,6 @@ import java.io.IOException; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -28,15 +26,15 @@ public class RestSetUpgradeModeAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestSetUpgradeModeAction.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.singletonList( - new ReplacedRestApi(POST, MachineLearning.BASE_PATH + "set_upgrade_mode", + new ReplacedRoute(POST, MachineLearning.BASE_PATH + "set_upgrade_mode", POST, MachineLearning.PRE_V7_BASE_PATH + "set_upgrade_mode", deprecationLogger) ); diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestDeleteCalendarAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestDeleteCalendarAction.java index 207b67bd32ba1..d33200757e61d 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestDeleteCalendarAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestDeleteCalendarAction.java @@ -10,7 +10,6 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.DeleteCalendarAction; import org.elasticsearch.xpack.core.ml.calendars.Calendar; @@ -19,7 +18,6 @@ import java.io.IOException; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.DELETE; @@ -29,15 +27,15 @@ public class RestDeleteCalendarAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestDeleteCalendarAction.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.singletonList( - new ReplacedRestApi(DELETE, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}", + new ReplacedRoute(DELETE, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}", DELETE, MachineLearning.PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}", deprecationLogger) ); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestDeleteCalendarEventAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestDeleteCalendarEventAction.java index 745c4d3c41ed1..00191d34d02f3 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestDeleteCalendarEventAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestDeleteCalendarEventAction.java @@ -10,7 +10,6 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.DeleteCalendarEventAction; import org.elasticsearch.xpack.core.ml.calendars.Calendar; @@ -20,7 +19,6 @@ import java.io.IOException; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.DELETE; @@ -30,15 +28,15 @@ public class RestDeleteCalendarEventAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestDeleteCalendarEventAction.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.singletonList( - new ReplacedRestApi(DELETE, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/events/{" + + new ReplacedRoute(DELETE, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/events/{" + ScheduledEvent.EVENT_ID.getPreferredName() + "}", DELETE, MachineLearning.PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/events/{" + ScheduledEvent.EVENT_ID.getPreferredName() + "}", deprecationLogger) diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestDeleteCalendarJobAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestDeleteCalendarJobAction.java index 0c71432e17200..8d43a580b1b32 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestDeleteCalendarJobAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestDeleteCalendarJobAction.java @@ -10,7 +10,6 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.UpdateCalendarJobAction; import org.elasticsearch.xpack.core.ml.calendars.Calendar; @@ -20,7 +19,6 @@ import java.io.IOException; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.DELETE; @@ -30,15 +28,15 @@ public class RestDeleteCalendarJobAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestDeleteCalendarJobAction.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.singletonList( - new ReplacedRestApi(DELETE, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/jobs/{" + + new ReplacedRoute(DELETE, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/jobs/{" + Job.ID.getPreferredName() + "}", DELETE, MachineLearning.PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/jobs/{" + Job.ID.getPreferredName() + "}", deprecationLogger) diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestGetCalendarEventsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestGetCalendarEventsAction.java index 215a96c25aaa9..50926b5b2db08 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestGetCalendarEventsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestGetCalendarEventsAction.java @@ -11,7 +11,6 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.action.util.PageParams; import org.elasticsearch.xpack.core.ml.action.GetCalendarEventsAction; @@ -22,7 +21,6 @@ import java.io.IOException; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.GET; @@ -32,15 +30,15 @@ public class RestGetCalendarEventsAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestGetCalendarEventsAction.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.singletonList( - new ReplacedRestApi(GET, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/events", + new ReplacedRoute(GET, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/events", GET, MachineLearning.PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/events", deprecationLogger) ); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestGetCalendarsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestGetCalendarsAction.java index 16e8f63bfdb32..d2d9dc07505db 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestGetCalendarsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestGetCalendarsAction.java @@ -12,7 +12,6 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestStatusToXContentListener; import org.elasticsearch.xpack.core.action.util.PageParams; import org.elasticsearch.xpack.core.ml.action.GetCalendarsAction; @@ -23,7 +22,6 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -34,21 +32,21 @@ public class RestGetCalendarsAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestGetCalendarsAction.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.unmodifiableList(Arrays.asList( - new ReplacedRestApi(GET, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}", + new ReplacedRoute(GET, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}", GET, MachineLearning.PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}", deprecationLogger), - new ReplacedRestApi(GET, MachineLearning.BASE_PATH + "calendars/", + new ReplacedRoute(GET, MachineLearning.BASE_PATH + "calendars/", GET, MachineLearning.PRE_V7_BASE_PATH + "calendars/", deprecationLogger), - new ReplacedRestApi(POST, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}", + new ReplacedRoute(POST, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}", POST, MachineLearning.PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}", deprecationLogger), - new ReplacedRestApi(POST, MachineLearning.BASE_PATH + "calendars/", + new ReplacedRoute(POST, MachineLearning.BASE_PATH + "calendars/", POST, MachineLearning.PRE_V7_BASE_PATH + "calendars/", deprecationLogger) )); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestPostCalendarEventAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestPostCalendarEventAction.java index bb1a52231062a..e670695c8822e 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestPostCalendarEventAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestPostCalendarEventAction.java @@ -11,7 +11,6 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.PostCalendarEventsAction; import org.elasticsearch.xpack.core.ml.calendars.Calendar; @@ -20,7 +19,6 @@ import java.io.IOException; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -30,15 +28,15 @@ public class RestPostCalendarEventAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestPostCalendarEventAction.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.singletonList( - new ReplacedRestApi(POST, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/events", + new ReplacedRoute(POST, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/events", POST, MachineLearning.PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/events", deprecationLogger) ); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestPutCalendarAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestPutCalendarAction.java index d75c43b8854df..0d2d2c57ff075 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestPutCalendarAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestPutCalendarAction.java @@ -11,7 +11,6 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.PutCalendarAction; import org.elasticsearch.xpack.core.ml.calendars.Calendar; @@ -20,7 +19,6 @@ import java.io.IOException; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.PUT; @@ -30,15 +28,15 @@ public class RestPutCalendarAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestPutCalendarAction.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.singletonList( - new ReplacedRestApi(PUT, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}", + new ReplacedRoute(PUT, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}", PUT, MachineLearning.PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}", deprecationLogger) ); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestPutCalendarJobAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestPutCalendarJobAction.java index 8201c006b1bf3..03de5130b63ce 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestPutCalendarJobAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestPutCalendarJobAction.java @@ -10,7 +10,6 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.UpdateCalendarJobAction; import org.elasticsearch.xpack.core.ml.calendars.Calendar; @@ -20,7 +19,6 @@ import java.io.IOException; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.PUT; @@ -30,15 +28,15 @@ public class RestPutCalendarJobAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestPutCalendarJobAction.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.singletonList( - new ReplacedRestApi(PUT, + new ReplacedRoute(PUT, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/jobs/{" + Job.ID.getPreferredName() + "}", PUT, MachineLearning.PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/jobs/{" + diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/cat/RestCatDatafeedsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/cat/RestCatDatafeedsAction.java index 0d6301c8efef6..7009de7cd3181 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/cat/RestCatDatafeedsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/cat/RestCatDatafeedsAction.java @@ -9,10 +9,8 @@ import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.common.Strings; import org.elasticsearch.common.Table; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestResponseListener; import org.elasticsearch.rest.action.cat.AbstractCatAction; @@ -21,21 +19,19 @@ import org.elasticsearch.xpack.core.ml.datafeed.DatafeedConfig; import org.elasticsearch.xpack.core.ml.datafeed.DatafeedTimingStats; -import java.util.Collections; import java.util.List; -import java.util.Map; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestCatDatafeedsAction extends AbstractCatAction { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("_cat/ml/datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}", singletonList(GET)) - .put("_cat/ml/datafeeds", singletonList(GET)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("_cat/ml/datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}", GET), + new Route("_cat/ml/datafeeds", GET))); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/cat/RestCatJobsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/cat/RestCatJobsAction.java index 5596ddf8ddd21..88ad9fd5e8238 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/cat/RestCatJobsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/cat/RestCatJobsAction.java @@ -10,11 +10,9 @@ import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.common.Strings; import org.elasticsearch.common.Table; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestResponseListener; import org.elasticsearch.rest.action.cat.AbstractCatAction; @@ -26,21 +24,19 @@ import org.elasticsearch.xpack.core.ml.job.process.autodetect.state.TimingStats; import org.elasticsearch.xpack.core.ml.stats.ForecastStats; -import java.util.Collections; import java.util.List; -import java.util.Map; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestCatJobsAction extends AbstractCatAction { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("_cat/ml/anomaly_detectors/{" + Job.ID.getPreferredName() + "}", singletonList(GET)) - .put("_cat/ml/anomaly_detectors", singletonList(GET)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("_cat/ml/anomaly_detectors/{" + Job.ID.getPreferredName() + "}", GET), + new Route("_cat/ml/anomaly_detectors", GET))); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/cat/RestCatTrainedModelsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/cat/RestCatTrainedModelsAction.java index 7d5ec2c1805ff..80dde77a7ab87 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/cat/RestCatTrainedModelsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/cat/RestCatTrainedModelsAction.java @@ -12,11 +12,9 @@ import org.elasticsearch.cluster.metadata.MetaData; import org.elasticsearch.common.Strings; import org.elasticsearch.common.Table; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestResponseListener; import org.elasticsearch.rest.action.cat.AbstractCatAction; @@ -39,20 +37,18 @@ import java.util.function.Function; import java.util.stream.Collectors; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.xpack.core.ml.action.GetTrainedModelsAction.Request.ALLOW_NO_MATCH; public class RestCatTrainedModelsAction extends AbstractCatAction { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap( - MapBuilder.>newMapBuilder() - .put("_cat/ml/trained_models", singletonList(GET)) - .put("_cat/ml/trained_models/{" + TrainedModelConfig.MODEL_ID.getPreferredName() + "}", singletonList(GET)) - .map() - ); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("_cat/ml/trained_models", GET), + new Route("_cat/ml/trained_models/{" + TrainedModelConfig.MODEL_ID.getPreferredName() + "}", GET))); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestDeleteDatafeedAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestDeleteDatafeedAction.java index 7c2414a62fdbf..28805d91c76c8 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestDeleteDatafeedAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestDeleteDatafeedAction.java @@ -10,7 +10,6 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.CloseJobAction; import org.elasticsearch.xpack.core.ml.action.DeleteDatafeedAction; @@ -20,7 +19,6 @@ import java.io.IOException; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.DELETE; @@ -30,15 +28,15 @@ public class RestDeleteDatafeedAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestDeleteDatafeedAction.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.singletonList( - new ReplacedRestApi(DELETE, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}", + new ReplacedRoute(DELETE, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}", DELETE, MachineLearning.PRE_V7_BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}", deprecationLogger) ); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestGetDatafeedStatsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestGetDatafeedStatsAction.java index c2970168f2657..0cd9a0b5a7fcd 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestGetDatafeedStatsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestGetDatafeedStatsAction.java @@ -11,7 +11,6 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.GetDatafeedsStatsAction; import org.elasticsearch.xpack.core.ml.datafeed.DatafeedConfig; @@ -21,7 +20,6 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.GET; @@ -31,18 +29,18 @@ public class RestGetDatafeedStatsAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestGetDatafeedStatsAction.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.unmodifiableList(Arrays.asList( - new ReplacedRestApi(GET, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_stats", + new ReplacedRoute(GET, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_stats", GET, MachineLearning.PRE_V7_BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_stats", deprecationLogger), - new ReplacedRestApi(GET, MachineLearning.BASE_PATH + "datafeeds/_stats", + new ReplacedRoute(GET, MachineLearning.BASE_PATH + "datafeeds/_stats", GET, MachineLearning.PRE_V7_BASE_PATH + "datafeeds/_stats", deprecationLogger) )); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestGetDatafeedsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestGetDatafeedsAction.java index 049e9ac448360..f4d6a155a8809 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestGetDatafeedsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestGetDatafeedsAction.java @@ -10,7 +10,6 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.GetDatafeedsAction; import org.elasticsearch.xpack.core.ml.datafeed.DatafeedConfig; @@ -20,7 +19,6 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.GET; @@ -30,17 +28,17 @@ public class RestGetDatafeedsAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestGetDatafeedsAction.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.unmodifiableList(Arrays.asList( - new ReplacedRestApi(GET, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}", + new ReplacedRoute(GET, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}", GET, MachineLearning.PRE_V7_BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}", deprecationLogger), - new ReplacedRestApi(GET, MachineLearning.BASE_PATH + "datafeeds", + new ReplacedRoute(GET, MachineLearning.BASE_PATH + "datafeeds", GET, MachineLearning.PRE_V7_BASE_PATH + "datafeeds", deprecationLogger) )); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestPreviewDatafeedAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestPreviewDatafeedAction.java index 9344ff406652e..a006d1e662768 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestPreviewDatafeedAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestPreviewDatafeedAction.java @@ -10,7 +10,6 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.PreviewDatafeedAction; import org.elasticsearch.xpack.core.ml.datafeed.DatafeedConfig; @@ -19,7 +18,6 @@ import java.io.IOException; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.GET; @@ -29,15 +27,15 @@ public class RestPreviewDatafeedAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestPreviewDatafeedAction.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.singletonList( - new ReplacedRestApi(GET, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_preview", + new ReplacedRoute(GET, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_preview", GET, MachineLearning.PRE_V7_BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_preview", deprecationLogger) ); diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestPutDatafeedAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestPutDatafeedAction.java index ed4e41bfcc9ff..d80dfa77b68b5 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestPutDatafeedAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestPutDatafeedAction.java @@ -11,7 +11,6 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.PutDatafeedAction; import org.elasticsearch.xpack.core.ml.datafeed.DatafeedConfig; @@ -20,7 +19,6 @@ import java.io.IOException; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.PUT; @@ -30,15 +28,15 @@ public class RestPutDatafeedAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestPutDatafeedAction.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.singletonList( - new ReplacedRestApi(PUT, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}", + new ReplacedRoute(PUT, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}", PUT, MachineLearning.PRE_V7_BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}", deprecationLogger) ); diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestStartDatafeedAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestStartDatafeedAction.java index 7b024e9528f98..26ba61ff7a53e 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestStartDatafeedAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestStartDatafeedAction.java @@ -15,7 +15,6 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -26,7 +25,6 @@ import java.io.IOException; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -38,15 +36,15 @@ public class RestStartDatafeedAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestStartDatafeedAction.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.singletonList( - new ReplacedRestApi(POST, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_start", + new ReplacedRoute(POST, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_start", POST, MachineLearning.PRE_V7_BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_start", deprecationLogger) ); diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestStopDatafeedAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestStopDatafeedAction.java index 2a51c22582686..a511af60c903f 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestStopDatafeedAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestStopDatafeedAction.java @@ -14,7 +14,6 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -26,7 +25,6 @@ import java.io.IOException; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -36,15 +34,15 @@ public class RestStopDatafeedAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestStopDatafeedAction.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.singletonList( - new ReplacedRestApi(POST, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_stop", + new ReplacedRoute(POST, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_stop", POST, MachineLearning.PRE_V7_BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_stop", deprecationLogger) ); diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestUpdateDatafeedAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestUpdateDatafeedAction.java index 1b116373bea85..fac6596e69b76 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestUpdateDatafeedAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestUpdateDatafeedAction.java @@ -11,7 +11,6 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.UpdateDatafeedAction; import org.elasticsearch.xpack.core.ml.datafeed.DatafeedConfig; @@ -20,7 +19,6 @@ import java.io.IOException; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -30,15 +28,15 @@ public class RestUpdateDatafeedAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestUpdateDatafeedAction.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.singletonList( - new ReplacedRestApi(POST, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_update", + new ReplacedRoute(POST, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_update", POST, MachineLearning.PRE_V7_BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_update", deprecationLogger) ); diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestDeleteDataFrameAnalyticsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestDeleteDataFrameAnalyticsAction.java index 2d0b5070e7454..a28aca5fa8c63 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestDeleteDataFrameAnalyticsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestDeleteDataFrameAnalyticsAction.java @@ -8,7 +8,6 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.DeleteDataFrameAnalyticsAction; import org.elasticsearch.xpack.core.ml.dataframe.DataFrameAnalyticsConfig; @@ -16,19 +15,16 @@ import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.DELETE; public class RestDeleteDataFrameAnalyticsAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap( - MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}", - singletonList(DELETE)); + public List handledRoutes() { + return singletonList( + new Route(MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}", DELETE)); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestEvaluateDataFrameAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestEvaluateDataFrameAction.java index 6e941be775133..344a34f3dbe72 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestEvaluateDataFrameAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestEvaluateDataFrameAction.java @@ -8,24 +8,21 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.EvaluateDataFrameAction; import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestEvaluateDataFrameAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap(MachineLearning.BASE_PATH + "data_frame/_evaluate", singletonList(POST)); + public List handledRoutes() { + return singletonList(new Route(MachineLearning.BASE_PATH + "data_frame/_evaluate", POST)); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestExplainDataFrameAnalyticsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestExplainDataFrameAnalyticsAction.java index b3d54873f7e26..0795672c0991e 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestExplainDataFrameAnalyticsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestExplainDataFrameAnalyticsAction.java @@ -8,10 +8,8 @@ import org.elasticsearch.action.ActionListener; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.ExplainDataFrameAnalyticsAction; import org.elasticsearch.xpack.core.ml.action.GetDataFrameAnalyticsAction; @@ -21,9 +19,7 @@ import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; import java.util.stream.Collectors; import static java.util.Arrays.asList; @@ -34,12 +30,14 @@ public class RestExplainDataFrameAnalyticsAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put(MachineLearning.BASE_PATH + "data_frame/analytics/_explain", unmodifiableList(asList(GET, POST))) - .put(MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}/_explain", - unmodifiableList(asList(GET, POST))) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route(MachineLearning.BASE_PATH + "data_frame/analytics/_explain", GET), + new Route(MachineLearning.BASE_PATH + "data_frame/analytics/_explain", POST), + new Route(MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}/_explain", + GET), + new Route(MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}/_explain", + POST))); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestGetDataFrameAnalyticsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestGetDataFrameAnalyticsAction.java index b8355f5e4a2c3..e0b0075aad2a9 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestGetDataFrameAnalyticsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestGetDataFrameAnalyticsAction.java @@ -7,10 +7,8 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.action.util.PageParams; import org.elasticsearch.xpack.core.ml.action.GetDataFrameAnalyticsAction; @@ -18,22 +16,19 @@ import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestGetDataFrameAnalyticsAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put(MachineLearning.BASE_PATH + "data_frame/analytics", singletonList(GET)) - .put(MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}", - singletonList(GET)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route(MachineLearning.BASE_PATH + "data_frame/analytics", GET), + new Route(MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}", GET))); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestGetDataFrameAnalyticsStatsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestGetDataFrameAnalyticsStatsAction.java index 624ffb0b7a0e0..c3d418fc0c40d 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestGetDataFrameAnalyticsStatsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestGetDataFrameAnalyticsStatsAction.java @@ -7,10 +7,8 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.action.util.PageParams; import org.elasticsearch.xpack.core.ml.action.GetDataFrameAnalyticsStatsAction; @@ -18,22 +16,20 @@ import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestGetDataFrameAnalyticsStatsAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put(MachineLearning.BASE_PATH + "data_frame/analytics/_stats", singletonList(GET)) - .put(MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}/_stats", - singletonList(GET)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route(MachineLearning.BASE_PATH + "data_frame/analytics/_stats", GET), + new Route(MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}/_stats", + GET))); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestPutDataFrameAnalyticsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestPutDataFrameAnalyticsAction.java index 1ff5bf44e1db4..13ef23240b80a 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestPutDataFrameAnalyticsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestPutDataFrameAnalyticsAction.java @@ -9,7 +9,6 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.PutDataFrameAnalyticsAction; import org.elasticsearch.xpack.core.ml.dataframe.DataFrameAnalyticsConfig; @@ -17,18 +16,16 @@ import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.PUT; public class RestPutDataFrameAnalyticsAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap(MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}", - singletonList(PUT)); + public List handledRoutes() { + return singletonList( + new Route(MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}", PUT)); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestStartDataFrameAnalyticsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestStartDataFrameAnalyticsAction.java index 0a30ee11dbf4a..f099002925e5f 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestStartDataFrameAnalyticsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestStartDataFrameAnalyticsAction.java @@ -9,7 +9,6 @@ import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.StartDataFrameAnalyticsAction; import org.elasticsearch.xpack.core.ml.dataframe.DataFrameAnalyticsConfig; @@ -17,19 +16,17 @@ import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestStartDataFrameAnalyticsAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap( - MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}/_start", - singletonList(POST)); + public List handledRoutes() { + return singletonList( + new Route(MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}/_start", + POST)); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestStopDataFrameAnalyticsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestStopDataFrameAnalyticsAction.java index 9c85c786b7f99..5260359b57653 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestStopDataFrameAnalyticsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestStopDataFrameAnalyticsAction.java @@ -8,7 +8,6 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.StopDataFrameAnalyticsAction; import org.elasticsearch.xpack.core.ml.dataframe.DataFrameAnalyticsConfig; @@ -16,19 +15,17 @@ import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestStopDataFrameAnalyticsAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap( - MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}/_stop", - singletonList(POST)); + public List handledRoutes() { + return singletonList( + new Route(MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}/_stop", + POST)); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestDeleteFilterAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestDeleteFilterAction.java index fc82939bb49ca..4820c92e8632c 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestDeleteFilterAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestDeleteFilterAction.java @@ -10,7 +10,6 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.DeleteFilterAction; import org.elasticsearch.xpack.core.ml.action.DeleteFilterAction.Request; @@ -19,7 +18,6 @@ import java.io.IOException; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.DELETE; @@ -29,15 +27,15 @@ public class RestDeleteFilterAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestDeleteFilterAction.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.singletonList( - new ReplacedRestApi(DELETE, MachineLearning.BASE_PATH + "filters/{" + Request.FILTER_ID.getPreferredName() + "}", + new ReplacedRoute(DELETE, MachineLearning.BASE_PATH + "filters/{" + Request.FILTER_ID.getPreferredName() + "}", DELETE, MachineLearning.PRE_V7_BASE_PATH + "filters/{" + Request.FILTER_ID.getPreferredName() + "}", deprecationLogger) ); diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestGetFiltersAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestGetFiltersAction.java index 34ec24f441b45..7dc21a4bf65f3 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestGetFiltersAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestGetFiltersAction.java @@ -11,7 +11,6 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestStatusToXContentListener; import org.elasticsearch.xpack.core.action.util.PageParams; import org.elasticsearch.xpack.core.ml.action.GetFiltersAction; @@ -22,7 +21,6 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.GET; @@ -32,18 +30,18 @@ public class RestGetFiltersAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestGetFiltersAction.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.unmodifiableList(Arrays.asList( - new ReplacedRestApi(GET, MachineLearning.BASE_PATH + "filters/{" + MlFilter.ID.getPreferredName() + "}", + new ReplacedRoute(GET, MachineLearning.BASE_PATH + "filters/{" + MlFilter.ID.getPreferredName() + "}", GET, MachineLearning.PRE_V7_BASE_PATH + "filters/{" + MlFilter.ID.getPreferredName() + "}", deprecationLogger), - new ReplacedRestApi(GET, MachineLearning.BASE_PATH + "filters/", + new ReplacedRoute(GET, MachineLearning.BASE_PATH + "filters/", GET, MachineLearning.PRE_V7_BASE_PATH + "filters/", deprecationLogger) )); diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestPutFilterAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestPutFilterAction.java index a5430d9e1ae56..627947529bc59 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestPutFilterAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestPutFilterAction.java @@ -11,7 +11,6 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.PutFilterAction; import org.elasticsearch.xpack.core.ml.job.config.MlFilter; @@ -20,7 +19,6 @@ import java.io.IOException; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.PUT; @@ -30,15 +28,15 @@ public class RestPutFilterAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestPutFilterAction.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.singletonList( - new ReplacedRestApi(PUT, MachineLearning.BASE_PATH + "filters/{" + MlFilter.ID.getPreferredName() + "}", + new ReplacedRoute(PUT, MachineLearning.BASE_PATH + "filters/{" + MlFilter.ID.getPreferredName() + "}", PUT, MachineLearning.PRE_V7_BASE_PATH + "filters/{" + MlFilter.ID.getPreferredName() + "}", deprecationLogger) ); diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestUpdateFilterAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestUpdateFilterAction.java index 74542572facf1..2a9607af5f557 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestUpdateFilterAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestUpdateFilterAction.java @@ -11,7 +11,6 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.UpdateFilterAction; import org.elasticsearch.xpack.core.ml.job.config.MlFilter; @@ -20,7 +19,6 @@ import java.io.IOException; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -30,15 +28,15 @@ public class RestUpdateFilterAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestUpdateFilterAction.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.singletonList( - new ReplacedRestApi(POST, MachineLearning.BASE_PATH + "filters/{" + MlFilter.ID.getPreferredName() + "}/_update", + new ReplacedRoute(POST, MachineLearning.BASE_PATH + "filters/{" + MlFilter.ID.getPreferredName() + "}/_update", POST, MachineLearning.PRE_V7_BASE_PATH + "filters/{" + MlFilter.ID.getPreferredName() + "}/_update", deprecationLogger) ); diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestDeleteTrainedModelAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestDeleteTrainedModelAction.java index e8af002b04f59..2709b1ad7cbb1 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestDeleteTrainedModelAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestDeleteTrainedModelAction.java @@ -8,7 +8,6 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.DeleteTrainedModelAction; import org.elasticsearch.xpack.core.ml.inference.TrainedModelConfig; @@ -16,18 +15,16 @@ import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.DELETE; public class RestDeleteTrainedModelAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap(MachineLearning.BASE_PATH + "inference/{" + TrainedModelConfig.MODEL_ID.getPreferredName() + "}", - singletonList(DELETE)); + public List handledRoutes() { + return singletonList( + new Route(MachineLearning.BASE_PATH + "inference/{" + TrainedModelConfig.MODEL_ID.getPreferredName() + "}", DELETE)); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestGetTrainedModelsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestGetTrainedModelsAction.java index e1e593cee11bc..15292373baeb1 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestGetTrainedModelsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestGetTrainedModelsAction.java @@ -8,10 +8,8 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.cluster.metadata.MetaData; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.action.util.PageParams; import org.elasticsearch.xpack.core.ml.action.GetTrainedModelsAction; @@ -19,24 +17,22 @@ import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; -import java.util.Arrays; import java.util.Collections; import java.util.List; -import java.util.Map; import java.util.Set; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.xpack.core.ml.action.GetTrainedModelsAction.Request.ALLOW_NO_MATCH; public class RestGetTrainedModelsAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put(MachineLearning.BASE_PATH + "inference/{" + TrainedModelConfig.MODEL_ID.getPreferredName() + "}", singletonList(GET)) - .put(MachineLearning.BASE_PATH + "inference", singletonList(GET)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route(MachineLearning.BASE_PATH + "inference/{" + TrainedModelConfig.MODEL_ID.getPreferredName() + "}", GET), + new Route(MachineLearning.BASE_PATH + "inference", GET))); } @Override @@ -54,7 +50,7 @@ protected RestChannelConsumer prepareRequest(RestRequest restRequest, NodeClient GetTrainedModelsAction.Request.INCLUDE_MODEL_DEFINITION.getPreferredName(), false ); - List tags = Arrays.asList(restRequest.paramAsStringArray(TrainedModelConfig.TAGS.getPreferredName(), Strings.EMPTY_ARRAY)); + List tags = asList(restRequest.paramAsStringArray(TrainedModelConfig.TAGS.getPreferredName(), Strings.EMPTY_ARRAY)); GetTrainedModelsAction.Request request = new GetTrainedModelsAction.Request(modelId, includeModelDefinition, tags); if (restRequest.hasParam(PageParams.FROM.getPreferredName()) || restRequest.hasParam(PageParams.SIZE.getPreferredName())) { request.setPageParams(new PageParams(restRequest.paramAsInt(PageParams.FROM.getPreferredName(), PageParams.DEFAULT_FROM), diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestGetTrainedModelsStatsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestGetTrainedModelsStatsAction.java index 826a5702fa148..d97fae9f664cc 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestGetTrainedModelsStatsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestGetTrainedModelsStatsAction.java @@ -8,10 +8,8 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.cluster.metadata.MetaData; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.action.util.PageParams; import org.elasticsearch.xpack.core.ml.action.GetTrainedModelsStatsAction; @@ -19,23 +17,20 @@ import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.xpack.core.ml.action.GetTrainedModelsAction.Request.ALLOW_NO_MATCH; public class RestGetTrainedModelsStatsAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put(MachineLearning.BASE_PATH + "inference/{" + TrainedModelConfig.MODEL_ID.getPreferredName() + "}/_stats", - singletonList(GET)) - .put(MachineLearning.BASE_PATH + MachineLearning.BASE_PATH + "inference/_stats", singletonList(GET)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route(MachineLearning.BASE_PATH + "inference/{" + TrainedModelConfig.MODEL_ID.getPreferredName() + "}/_stats", GET), + new Route(MachineLearning.BASE_PATH + MachineLearning.BASE_PATH + "inference/_stats", GET))); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestPutTrainedModelAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestPutTrainedModelAction.java index 846f5f7b11fd1..ba536ede14709 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestPutTrainedModelAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestPutTrainedModelAction.java @@ -9,7 +9,6 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.PutTrainedModelAction; import org.elasticsearch.xpack.core.ml.inference.TrainedModelConfig; @@ -17,18 +16,16 @@ import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.PUT; public class RestPutTrainedModelAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap(MachineLearning.BASE_PATH + "inference/{" + TrainedModelConfig.MODEL_ID.getPreferredName() + "}", - singletonList(PUT)); + public List handledRoutes() { + return singletonList( + new Route(MachineLearning.BASE_PATH + "inference/{" + TrainedModelConfig.MODEL_ID.getPreferredName() + "}", PUT)); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestCloseJobAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestCloseJobAction.java index c7487860b6a5d..36cd8198458b8 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestCloseJobAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestCloseJobAction.java @@ -11,7 +11,6 @@ import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.CloseJobAction; import org.elasticsearch.xpack.core.ml.action.CloseJobAction.Request; @@ -21,7 +20,6 @@ import java.io.IOException; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -31,15 +29,15 @@ public class RestCloseJobAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestCloseJobAction.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.singletonList( - new ReplacedRestApi(POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_close", + new ReplacedRoute(POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_close", POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_close", deprecationLogger) ); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestDeleteForecastAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestDeleteForecastAction.java index dbc0374997a04..be227b8f5ac1f 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestDeleteForecastAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestDeleteForecastAction.java @@ -11,7 +11,6 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.DeleteForecastAction; import org.elasticsearch.xpack.core.ml.job.config.Job; @@ -20,10 +19,8 @@ import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.DELETE; public class RestDeleteForecastAction extends BaseRestHandler { @@ -32,16 +29,16 @@ public class RestDeleteForecastAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestDeleteForecastAction.class)); @Override - public Map> handledMethodsAndPaths() { - return singletonMap(MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_forecast/", - singletonList(DELETE)); + public List handledRoutes() { + return singletonList( + new Route(MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_forecast/", DELETE)); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return singletonList( - new ReplacedRestApi(DELETE, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + + new ReplacedRoute(DELETE, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_forecast/{" + Forecast.FORECAST_ID.getPreferredName() + "}", DELETE, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_forecast/{" + Forecast.FORECAST_ID.getPreferredName() + "}", deprecationLogger) diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestDeleteJobAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestDeleteJobAction.java index d259aff0664d7..7ada56b25b7cf 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestDeleteJobAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestDeleteJobAction.java @@ -12,7 +12,6 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.tasks.Task; @@ -25,7 +24,6 @@ import java.io.IOException; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.DELETE; @@ -35,15 +33,15 @@ public class RestDeleteJobAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestDeleteJobAction.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.singletonList( - new ReplacedRestApi(DELETE, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}", + new ReplacedRoute(DELETE, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}", DELETE, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}", deprecationLogger) ); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestFlushJobAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestFlushJobAction.java index 54953a5dafd8e..c105bc11ea0ca 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestFlushJobAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestFlushJobAction.java @@ -11,7 +11,6 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.FlushJobAction; import org.elasticsearch.xpack.core.ml.job.config.Job; @@ -20,7 +19,6 @@ import java.io.IOException; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -36,15 +34,15 @@ public class RestFlushJobAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestFlushJobAction.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.singletonList( - new ReplacedRestApi(POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_flush", + new ReplacedRoute(POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_flush", POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_flush", deprecationLogger) ); diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestForecastJobAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestForecastJobAction.java index af59241987f98..c144c50f74ec3 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestForecastJobAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestForecastJobAction.java @@ -11,7 +11,6 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.ForecastJobAction; import org.elasticsearch.xpack.core.ml.job.config.Job; @@ -20,7 +19,6 @@ import java.io.IOException; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -30,15 +28,15 @@ public class RestForecastJobAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestForecastJobAction.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.singletonList( - new ReplacedRestApi(POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_forecast", + new ReplacedRoute(POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_forecast", POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_forecast", deprecationLogger) ); diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestGetJobStatsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestGetJobStatsAction.java index ec447cca9bdc7..21b9b72c2c104 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestGetJobStatsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestGetJobStatsAction.java @@ -12,7 +12,6 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.GetJobsStatsAction; import org.elasticsearch.xpack.core.ml.job.config.Job; @@ -22,7 +21,6 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.GET; @@ -32,18 +30,18 @@ public class RestGetJobStatsAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestGetJobStatsAction.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.unmodifiableList(Arrays.asList( - new ReplacedRestApi(GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_stats", + new ReplacedRoute(GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_stats", GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_stats", deprecationLogger), - new ReplacedRestApi(GET, MachineLearning.BASE_PATH + "anomaly_detectors/_stats", + new ReplacedRoute(GET, MachineLearning.BASE_PATH + "anomaly_detectors/_stats", GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/_stats", deprecationLogger) )); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestGetJobsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestGetJobsAction.java index b1da929ce22a4..3b5eb4ec58bd5 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestGetJobsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestGetJobsAction.java @@ -12,7 +12,6 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.GetJobsAction; import org.elasticsearch.xpack.core.ml.job.config.Job; @@ -22,7 +21,6 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.GET; @@ -32,18 +30,18 @@ public class RestGetJobsAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestGetJobsAction.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.unmodifiableList(Arrays.asList( - new ReplacedRestApi(GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}", + new ReplacedRoute(GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}", GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}", deprecationLogger), - new ReplacedRestApi(GET, MachineLearning.BASE_PATH + "anomaly_detectors", + new ReplacedRoute(GET, MachineLearning.BASE_PATH + "anomaly_detectors", GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors", deprecationLogger) )); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestOpenJobAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestOpenJobAction.java index ebf94142f887d..0f044c67853b6 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestOpenJobAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestOpenJobAction.java @@ -14,7 +14,6 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -25,7 +24,6 @@ import java.io.IOException; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -35,15 +33,15 @@ public class RestOpenJobAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestOpenJobAction.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.singletonList( - new ReplacedRestApi(POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_open", + new ReplacedRoute(POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_open", POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_open", deprecationLogger) ); diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPostDataAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPostDataAction.java index 21d0a690d4ed4..0af9a7c47ef80 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPostDataAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPostDataAction.java @@ -10,7 +10,6 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestStatusToXContentListener; import org.elasticsearch.xpack.core.ml.action.PostDataAction; import org.elasticsearch.xpack.core.ml.job.config.Job; @@ -19,7 +18,6 @@ import java.io.IOException; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -32,15 +30,15 @@ public class RestPostDataAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestPostDataAction.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.singletonList( - new ReplacedRestApi(POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_data", + new ReplacedRoute(POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_data", POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_data", deprecationLogger) ); diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPostJobUpdateAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPostJobUpdateAction.java index 002d35f9a217d..ffa0637d6ae62 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPostJobUpdateAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPostJobUpdateAction.java @@ -11,7 +11,6 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.UpdateJobAction; import org.elasticsearch.xpack.core.ml.job.config.Job; @@ -20,7 +19,6 @@ import java.io.IOException; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -30,15 +28,15 @@ public class RestPostJobUpdateAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestPostJobUpdateAction.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.singletonList( - new ReplacedRestApi(POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_update", + new ReplacedRoute(POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_update", POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_update", deprecationLogger) ); diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPutJobAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPutJobAction.java index 25f697ed89cc2..4fbfc8d2aab88 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPutJobAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPutJobAction.java @@ -11,7 +11,6 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.PutJobAction; import org.elasticsearch.xpack.core.ml.job.config.Job; @@ -20,7 +19,6 @@ import java.io.IOException; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.PUT; @@ -30,15 +28,15 @@ public class RestPutJobAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestPutJobAction.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.singletonList( - new ReplacedRestApi(PUT, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}", + new ReplacedRoute(PUT, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}", PUT, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}", deprecationLogger) ); diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestDeleteModelSnapshotAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestDeleteModelSnapshotAction.java index 60cf3d12ebea9..8cb3c1c808da3 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestDeleteModelSnapshotAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestDeleteModelSnapshotAction.java @@ -10,7 +10,6 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.DeleteModelSnapshotAction; import org.elasticsearch.xpack.core.ml.job.config.Job; @@ -20,7 +19,6 @@ import java.io.IOException; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.DELETE; @@ -30,15 +28,15 @@ public class RestDeleteModelSnapshotAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestDeleteModelSnapshotAction.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.singletonList( - new ReplacedRestApi(DELETE, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + + new ReplacedRoute(DELETE, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/model_snapshots/{" + ModelSnapshotField.SNAPSHOT_ID.getPreferredName() + "}", DELETE, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/model_snapshots/{" + ModelSnapshotField.SNAPSHOT_ID.getPreferredName() + "}", diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestGetModelSnapshotsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestGetModelSnapshotsAction.java index 7ef294a2411df..41da39b956b5d 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestGetModelSnapshotsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestGetModelSnapshotsAction.java @@ -11,7 +11,6 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.action.util.PageParams; import org.elasticsearch.xpack.core.ml.action.GetModelSnapshotsAction; @@ -23,7 +22,6 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -44,30 +42,30 @@ public class RestGetModelSnapshotsAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestGetModelSnapshotsAction.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.unmodifiableList(Arrays.asList( - new ReplacedRestApi(GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + new ReplacedRoute(GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/model_snapshots/{" + Request.SNAPSHOT_ID.getPreferredName() + "}", GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/model_snapshots/{" + Request.SNAPSHOT_ID.getPreferredName() + "}", deprecationLogger), - new ReplacedRestApi(POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + new ReplacedRoute(POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/model_snapshots/{" + Request.SNAPSHOT_ID.getPreferredName() + "}", POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/model_snapshots/{" + Request.SNAPSHOT_ID.getPreferredName() + "}", deprecationLogger), - new ReplacedRestApi(GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + new ReplacedRoute(GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/model_snapshots", GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/model_snapshots", deprecationLogger), - new ReplacedRestApi(POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + new ReplacedRoute(POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/model_snapshots", POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/model_snapshots", diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestRevertModelSnapshotAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestRevertModelSnapshotAction.java index 898423fc4008f..4f5167250e4af 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestRevertModelSnapshotAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestRevertModelSnapshotAction.java @@ -11,7 +11,6 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestStatusToXContentListener; import org.elasticsearch.xpack.core.ml.action.RevertModelSnapshotAction; import org.elasticsearch.xpack.core.ml.job.config.Job; @@ -20,7 +19,6 @@ import java.io.IOException; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -32,15 +30,15 @@ public class RestRevertModelSnapshotAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestRevertModelSnapshotAction.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.singletonList( - new ReplacedRestApi( + new ReplacedRoute( POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/model_snapshots/{" + RevertModelSnapshotAction.Request.SNAPSHOT_ID.getPreferredName() + "}/_revert", POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/model_snapshots/{" + diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestUpdateModelSnapshotAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestUpdateModelSnapshotAction.java index 5c336cd57dfe2..9bdf2a2083f20 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestUpdateModelSnapshotAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestUpdateModelSnapshotAction.java @@ -11,7 +11,6 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestStatusToXContentListener; import org.elasticsearch.xpack.core.ml.action.UpdateModelSnapshotAction; import org.elasticsearch.xpack.core.ml.job.config.Job; @@ -21,7 +20,6 @@ import java.io.IOException; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -31,15 +29,15 @@ public class RestUpdateModelSnapshotAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestUpdateModelSnapshotAction.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.singletonList( - new ReplacedRestApi(POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + new ReplacedRoute(POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/model_snapshots/{" + ModelSnapshotField.SNAPSHOT_ID +"}/_update", POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/model_snapshots/{" + ModelSnapshotField.SNAPSHOT_ID +"}/_update", diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetBucketsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetBucketsAction.java index c767be6f03cc3..ddda3ef19bc4f 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetBucketsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetBucketsAction.java @@ -12,7 +12,6 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.action.util.PageParams; import org.elasticsearch.xpack.core.ml.action.GetBucketsAction; @@ -24,7 +23,6 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -35,30 +33,30 @@ public class RestGetBucketsAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestGetBucketsAction.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.unmodifiableList(Arrays.asList( - new ReplacedRestApi(GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + new ReplacedRoute(GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/buckets/{" + Result.TIMESTAMP.getPreferredName() + "}", GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/buckets/{" + Result.TIMESTAMP.getPreferredName() + "}", deprecationLogger), - new ReplacedRestApi(POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + new ReplacedRoute(POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/buckets/{" + Result.TIMESTAMP.getPreferredName() + "}", POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/buckets/{" + Result.TIMESTAMP.getPreferredName() + "}", deprecationLogger), - new ReplacedRestApi(GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + new ReplacedRoute(GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/buckets", GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/buckets", deprecationLogger), - new ReplacedRestApi(POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + new ReplacedRoute(POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/buckets", POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/buckets", diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetCategoriesAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetCategoriesAction.java index 6e7a28c1c7a8a..ce1db9d42ebe5 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetCategoriesAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetCategoriesAction.java @@ -11,7 +11,6 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.action.util.PageParams; import org.elasticsearch.xpack.core.ml.action.GetCategoriesAction; @@ -23,7 +22,6 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -34,30 +32,30 @@ public class RestGetCategoriesAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestGetCategoriesAction.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.unmodifiableList(Arrays.asList( - new ReplacedRestApi( + new ReplacedRoute( GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/categories/{" + Request.CATEGORY_ID.getPreferredName() + "}", GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/categories/{" + Request.CATEGORY_ID.getPreferredName() + "}", deprecationLogger), - new ReplacedRestApi(POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + + new ReplacedRoute(POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/categories/{" + Request.CATEGORY_ID.getPreferredName() + "}", POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/categories/{" + Request.CATEGORY_ID.getPreferredName() + "}", deprecationLogger), - new ReplacedRestApi( + new ReplacedRoute( GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/categories", GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/categories", deprecationLogger), - new ReplacedRestApi( + new ReplacedRoute( POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/categories", POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/categories", deprecationLogger) diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetInfluencersAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetInfluencersAction.java index 3c65ec9753640..c0e1515c62c15 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetInfluencersAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetInfluencersAction.java @@ -11,7 +11,6 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.action.util.PageParams; import org.elasticsearch.xpack.core.ml.action.GetInfluencersAction; @@ -22,7 +21,6 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -33,19 +31,19 @@ public class RestGetInfluencersAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestGetInfluencersAction.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.unmodifiableList(Arrays.asList( - new ReplacedRestApi( + new ReplacedRoute( GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/influencers", GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/influencers", deprecationLogger), - new ReplacedRestApi( + new ReplacedRoute( POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/influencers", POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/influencers", deprecationLogger) diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetOverallBucketsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetOverallBucketsAction.java index b083a16777df1..40f6fa7c72104 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetOverallBucketsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetOverallBucketsAction.java @@ -11,7 +11,6 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.GetOverallBucketsAction; import org.elasticsearch.xpack.core.ml.action.GetOverallBucketsAction.Request; @@ -22,7 +21,6 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -33,19 +31,19 @@ public class RestGetOverallBucketsAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestGetOverallBucketsAction.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.unmodifiableList(Arrays.asList( - new ReplacedRestApi( + new ReplacedRoute( GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/overall_buckets", GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/overall_buckets", deprecationLogger), - new ReplacedRestApi( + new ReplacedRoute( POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/overall_buckets", POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/overall_buckets", deprecationLogger) diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetRecordsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetRecordsAction.java index 757faff89af71..3318a577d7d01 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetRecordsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetRecordsAction.java @@ -11,7 +11,6 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.action.util.PageParams; import org.elasticsearch.xpack.core.ml.action.GetRecordsAction; @@ -22,7 +21,6 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -33,19 +31,19 @@ public class RestGetRecordsAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestGetRecordsAction.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.unmodifiableList(Arrays.asList( - new ReplacedRestApi( + new ReplacedRoute( GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/records", GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/records", deprecationLogger), - new ReplacedRestApi( + new ReplacedRoute( POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/records", POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/records", deprecationLogger) diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/validate/RestValidateDetectorAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/validate/RestValidateDetectorAction.java index fe852de54bdf8..f67022ef4bcd8 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/validate/RestValidateDetectorAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/validate/RestValidateDetectorAction.java @@ -11,7 +11,6 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.ValidateDetectorAction; import org.elasticsearch.xpack.ml.MachineLearning; @@ -19,7 +18,6 @@ import java.io.IOException; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -29,15 +27,15 @@ public class RestValidateDetectorAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestValidateDetectorAction.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.singletonList( - new ReplacedRestApi(POST, MachineLearning.BASE_PATH + "anomaly_detectors/_validate/detector", + new ReplacedRoute(POST, MachineLearning.BASE_PATH + "anomaly_detectors/_validate/detector", POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/_validate/detector", deprecationLogger) ); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/validate/RestValidateJobConfigAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/validate/RestValidateJobConfigAction.java index 23936c5d7a056..4480c3fde28d6 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/validate/RestValidateJobConfigAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/validate/RestValidateJobConfigAction.java @@ -11,7 +11,6 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.ml.action.ValidateJobConfigAction; import org.elasticsearch.xpack.ml.MachineLearning; @@ -19,7 +18,6 @@ import java.io.IOException; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -29,15 +27,15 @@ public class RestValidateJobConfigAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestValidateJobConfigAction.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.singletonList( - new ReplacedRestApi(POST, MachineLearning.BASE_PATH + "anomaly_detectors/_validate", + new ReplacedRoute(POST, MachineLearning.BASE_PATH + "anomaly_detectors/_validate", POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/_validate", deprecationLogger) ); } diff --git a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/rest/action/RestMonitoringBulkAction.java b/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/rest/action/RestMonitoringBulkAction.java index f9694a84596e3..db372c5fcaa84 100644 --- a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/rest/action/RestMonitoringBulkAction.java +++ b/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/rest/action/RestMonitoringBulkAction.java @@ -13,7 +13,6 @@ import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.action.RestBuilderListener; import org.elasticsearch.xpack.core.monitoring.MonitoredSystem; @@ -27,7 +26,6 @@ import static java.util.Arrays.asList; import static java.util.Collections.emptyList; -import static java.util.Collections.singletonMap; import static java.util.Collections.unmodifiableList; import static org.elasticsearch.common.unit.TimeValue.parseTimeValue; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -50,8 +48,10 @@ public class RestMonitoringBulkAction extends BaseRestHandler { MonitoredSystem.BEATS, ALL_VERSIONS); @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_monitoring/bulk", unmodifiableList(asList(POST, PUT))); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_monitoring/bulk", POST), + new Route("/_monitoring/bulk", PUT))); } @Override diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestDeleteRollupJobAction.java b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestDeleteRollupJobAction.java index c74b7c633f471..12fec56c5f22d 100644 --- a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestDeleteRollupJobAction.java +++ b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestDeleteRollupJobAction.java @@ -10,16 +10,13 @@ import org.elasticsearch.common.ParseField; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.rollup.action.DeleteRollupJobAction; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.DELETE; public class RestDeleteRollupJobAction extends BaseRestHandler { @@ -27,8 +24,8 @@ public class RestDeleteRollupJobAction extends BaseRestHandler { public static final ParseField ID = new ParseField("id"); @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_rollup/job/{id}", singletonList(DELETE)); + public List handledRoutes() { + return singletonList(new Route("/_rollup/job/{id}", DELETE)); } @Override diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupCapsAction.java b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupCapsAction.java index d31ef355eb120..5ae833455b6f4 100644 --- a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupCapsAction.java +++ b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupCapsAction.java @@ -10,15 +10,12 @@ import org.elasticsearch.common.ParseField; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.rollup.action.GetRollupCapsAction; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestGetRollupCapsAction extends BaseRestHandler { @@ -26,8 +23,8 @@ public class RestGetRollupCapsAction extends BaseRestHandler { public static final ParseField ID = new ParseField("id"); @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_rollup/data/{id}", singletonList(GET)); + public List handledRoutes() { + return singletonList(new Route("/_rollup/data/{id}", GET)); } @Override diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupIndexCapsAction.java b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupIndexCapsAction.java index f545b0b91ec50..54671b329a1c7 100644 --- a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupIndexCapsAction.java +++ b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupIndexCapsAction.java @@ -12,15 +12,12 @@ import org.elasticsearch.common.Strings; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.rollup.action.GetRollupIndexCapsAction; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestGetRollupIndexCapsAction extends BaseRestHandler { @@ -28,8 +25,8 @@ public class RestGetRollupIndexCapsAction extends BaseRestHandler { static final ParseField INDEX = new ParseField("index"); @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/{index}/_rollup/data", singletonList(GET)); + public List handledRoutes() { + return singletonList(new Route("/{index}/_rollup/data", GET)); } @Override diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupJobsAction.java b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupJobsAction.java index 9dbf2bb7a417f..c89cba0e98dec 100644 --- a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupJobsAction.java +++ b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupJobsAction.java @@ -10,15 +10,12 @@ import org.elasticsearch.common.ParseField; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.rollup.action.GetRollupJobsAction; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestGetRollupJobsAction extends BaseRestHandler { @@ -26,8 +23,8 @@ public class RestGetRollupJobsAction extends BaseRestHandler { public static final ParseField ID = new ParseField("id"); @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_rollup/job/{id}", singletonList(GET)); + public List handledRoutes() { + return singletonList(new Route("/_rollup/job/{id}", GET)); } @Override diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestPutRollupJobAction.java b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestPutRollupJobAction.java index 9b7e2005de553..0ca31c0440897 100644 --- a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestPutRollupJobAction.java +++ b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestPutRollupJobAction.java @@ -9,23 +9,20 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.rollup.action.PutRollupJobAction; import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.PUT; public class RestPutRollupJobAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_rollup/job/{id}", singletonList(PUT)); + public List handledRoutes() { + return singletonList(new Route("/_rollup/job/{id}", PUT)); } @Override diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestRollupSearchAction.java b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestRollupSearchAction.java index 90269511c1870..a42e4c13609d9 100644 --- a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestRollupSearchAction.java +++ b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestRollupSearchAction.java @@ -7,18 +7,14 @@ import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.rest.action.search.RestSearchAction; import org.elasticsearch.xpack.core.rollup.action.RollupSearchAction; import java.io.IOException; -import java.util.Collections; import java.util.List; -import java.util.Map; import java.util.Set; import static java.util.Arrays.asList; @@ -31,11 +27,12 @@ public class RestRollupSearchAction extends BaseRestHandler { private static final Set RESPONSE_PARAMS = Set.of(RestSearchAction.TYPED_KEYS_PARAM, RestSearchAction.TOTAL_HITS_AS_INT_PARAM); @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("_rollup_search", unmodifiableList(asList(GET, POST))) - .put("{index}/_rollup_search", unmodifiableList(asList(GET, POST))) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("_rollup_search", GET), + new Route("_rollup_search", POST), + new Route("{index}/_rollup_search", GET), + new Route("{index}/_rollup_search", POST))); } @Override diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestStartRollupJobAction.java b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestStartRollupJobAction.java index cab8c893bc5a7..0b65188f97f2d 100644 --- a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestStartRollupJobAction.java +++ b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestStartRollupJobAction.java @@ -9,23 +9,20 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.rollup.RollupField; import org.elasticsearch.xpack.core.rollup.action.StartRollupJobAction; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestStartRollupJobAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_rollup/job/{id}/_start", singletonList(POST)); + public List handledRoutes() { + return singletonList(new Route("/_rollup/job/{id}/_start", POST)); } @Override diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestStopRollupJobAction.java b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestStopRollupJobAction.java index 2b4edffae875e..940c9b6ad5ae4 100644 --- a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestStopRollupJobAction.java +++ b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestStopRollupJobAction.java @@ -10,23 +10,20 @@ import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.rollup.RollupField; import org.elasticsearch.xpack.core.rollup.action.StopRollupJobAction; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestStopRollupJobAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_rollup/job/{id}/_stop", singletonList(POST)); + public List handledRoutes() { + return singletonList(new Route("/_rollup/job/{id}/_stop", POST)); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/SecurityRestFilter.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/SecurityRestFilter.java index 22d4808860567..3eae11bbfc94e 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/SecurityRestFilter.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/SecurityRestFilter.java @@ -25,7 +25,6 @@ import java.io.IOException; import java.util.List; -import java.util.Map; public class SecurityRestFilter implements RestHandler { @@ -94,18 +93,18 @@ public boolean allowsUnsafeBuffers() { } @Override - public Map> handledMethodsAndPaths() { - return restHandler.handledMethodsAndPaths(); + public List handledRoutes() { + return restHandler.handledRoutes(); } @Override - public List deprecatedHandledMethodsAndPaths() { - return restHandler.deprecatedHandledMethodsAndPaths(); + public List deprecatedRoutes() { + return restHandler.deprecatedRoutes(); } @Override - public List replacedMethodsAndPaths() { - return restHandler.replacedMethodsAndPaths(); + public List replacedRoutes() { + return restHandler.replacedRoutes(); } private RestRequest maybeWrapRestRequest(RestRequest restRequest) throws IOException { diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/RestAuthenticateAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/RestAuthenticateAction.java index 60deb9ef4b1a1..d6542348b7457 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/RestAuthenticateAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/RestAuthenticateAction.java @@ -14,7 +14,6 @@ import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -27,7 +26,6 @@ import java.io.IOException; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.GET; @@ -42,14 +40,14 @@ public RestAuthenticateAction(Settings settings, SecurityContext securityContext } @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 - return Collections.singletonList(new ReplacedRestApi(GET, "/_security/_authenticate", GET, + return Collections.singletonList(new ReplacedRoute(GET, "/_security/_authenticate", GET, "/_xpack/security/_authenticate", deprecationLogger)); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/RestDelegatePkiAuthenticationAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/RestDelegatePkiAuthenticationAction.java index 9076fc46fe0f9..36e85676d2c31 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/RestDelegatePkiAuthenticationAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/RestDelegatePkiAuthenticationAction.java @@ -16,7 +16,6 @@ import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -29,10 +28,8 @@ import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.POST; /** @@ -49,8 +46,8 @@ public RestDelegatePkiAuthenticationAction(Settings settings, XPackLicenseState } @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_security/delegate_pki", singletonList(POST)); + public List handledRoutes() { + return singletonList(new Route("/_security/delegate_pki", POST)); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestCreateApiKeyAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestCreateApiKeyAction.java index 4f1cedc347564..f4a75b61f4356 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestCreateApiKeyAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestCreateApiKeyAction.java @@ -11,17 +11,14 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.security.action.CreateApiKeyRequest; import org.elasticsearch.xpack.core.security.action.CreateApiKeyRequestBuilder; import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Arrays.asList; -import static java.util.Collections.singletonMap; import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.RestRequest.Method.PUT; @@ -41,8 +38,10 @@ public RestCreateApiKeyAction(Settings settings, XPackLicenseState licenseState) } @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_security/api_key", unmodifiableList(asList(POST, PUT))); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_security/api_key", POST), + new Route("/_security/api_key", PUT))); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestGetApiKeyAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestGetApiKeyAction.java index ccef1616f7eff..05f1fe0040ed2 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestGetApiKeyAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestGetApiKeyAction.java @@ -13,7 +13,6 @@ import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -23,10 +22,8 @@ import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; /** @@ -39,8 +36,8 @@ public RestGetApiKeyAction(Settings settings, XPackLicenseState licenseState) { } @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_security/api_key", singletonList(GET)); + public List handledRoutes() { + return singletonList(new Route("/_security/api_key", GET)); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestInvalidateApiKeyAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestInvalidateApiKeyAction.java index 457aa98efabc3..9ac2d17ff16ef 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestInvalidateApiKeyAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestInvalidateApiKeyAction.java @@ -15,7 +15,6 @@ import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -25,10 +24,8 @@ import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.DELETE; /** @@ -54,8 +51,8 @@ public RestInvalidateApiKeyAction(Settings settings, XPackLicenseState licenseSt } @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_security/api_key", singletonList(DELETE)); + public List handledRoutes() { + return singletonList(new Route("/_security/api_key", DELETE)); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oauth2/RestGetTokenAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oauth2/RestGetTokenAction.java index ec07e007ac2da..6b2da8e9b5d3a 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oauth2/RestGetTokenAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oauth2/RestGetTokenAction.java @@ -24,7 +24,6 @@ import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.xpack.core.security.action.token.CreateTokenAction; import org.elasticsearch.xpack.core.security.action.token.CreateTokenRequest; @@ -37,7 +36,6 @@ import java.util.Collections; import java.util.List; import java.util.Locale; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -72,15 +70,15 @@ public RestGetTokenAction(Settings settings, XPackLicenseState xPackLicenseState } @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.singletonList( - new ReplacedRestApi(POST, "/_security/oauth2/token", POST, "/_xpack/security/oauth2/token", deprecationLogger) + new ReplacedRoute(POST, "/_security/oauth2/token", POST, "/_xpack/security/oauth2/token", deprecationLogger) ); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oauth2/RestInvalidateTokenAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oauth2/RestInvalidateTokenAction.java index 34a614f1f8885..7e6696c0bb472 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oauth2/RestInvalidateTokenAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oauth2/RestInvalidateTokenAction.java @@ -17,7 +17,6 @@ import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -28,7 +27,6 @@ import java.io.IOException; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.DELETE; @@ -71,15 +69,15 @@ public RestInvalidateTokenAction(Settings settings, XPackLicenseState xPackLicen } @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.singletonList( - new ReplacedRestApi(DELETE, "/_security/oauth2/token", DELETE, "/_xpack/security/oauth2/token", deprecationLogger) + new ReplacedRoute(DELETE, "/_security/oauth2/token", DELETE, "/_xpack/security/oauth2/token", deprecationLogger) ); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oidc/RestOpenIdConnectAuthenticateAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oidc/RestOpenIdConnectAuthenticateAction.java index 34101df73bbb3..c09b7bcfa326d 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oidc/RestOpenIdConnectAuthenticateAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oidc/RestOpenIdConnectAuthenticateAction.java @@ -16,7 +16,6 @@ import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -26,10 +25,8 @@ import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.POST; /** @@ -53,8 +50,8 @@ public RestOpenIdConnectAuthenticateAction(Settings settings, XPackLicenseState } @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_security/oidc/authenticate", singletonList(POST)); + public List handledRoutes() { + return singletonList(new Route("/_security/oidc/authenticate", POST)); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oidc/RestOpenIdConnectLogoutAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oidc/RestOpenIdConnectLogoutAction.java index b0b2a5b724698..b590c6b4f95c1 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oidc/RestOpenIdConnectLogoutAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oidc/RestOpenIdConnectLogoutAction.java @@ -14,7 +14,6 @@ import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -24,10 +23,8 @@ import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.POST; /** @@ -49,8 +46,8 @@ public RestOpenIdConnectLogoutAction(Settings settings, XPackLicenseState licens } @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_security/oidc/logout", singletonList(POST)); + public List handledRoutes() { + return singletonList(new Route("/_security/oidc/logout", POST)); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oidc/RestOpenIdConnectPrepareAuthenticationAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oidc/RestOpenIdConnectPrepareAuthenticationAction.java index 54694a482a86f..2cf4adcb209c8 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oidc/RestOpenIdConnectPrepareAuthenticationAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oidc/RestOpenIdConnectPrepareAuthenticationAction.java @@ -16,7 +16,6 @@ import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -26,10 +25,8 @@ import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.POST; /** @@ -54,8 +51,8 @@ public RestOpenIdConnectPrepareAuthenticationAction(Settings settings, XPackLice } @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_security/oidc/prepare", singletonList(POST)); + public List handledRoutes() { + return singletonList(new Route("/_security/oidc/prepare", POST)); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestDeletePrivilegesAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestDeletePrivilegesAction.java index c2682d765b7d0..27e567e7875f6 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestDeletePrivilegesAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestDeletePrivilegesAction.java @@ -13,7 +13,6 @@ import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -26,7 +25,6 @@ import java.util.Collections; import java.util.HashSet; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.DELETE; @@ -43,14 +41,14 @@ public RestDeletePrivilegesAction(Settings settings, XPackLicenseState licenseSt } @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 - return Collections.singletonList(new ReplacedRestApi(DELETE, "/_security/privilege/{application}/{privilege}", DELETE, + return Collections.singletonList(new ReplacedRoute(DELETE, "/_security/privilege/{application}/{privilege}", DELETE, "/_xpack/security/privilege/{application}/{privilege}", deprecationLogger)); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestGetBuiltinPrivilegesAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestGetBuiltinPrivilegesAction.java index 72a394f9e1f90..83286bb329c79 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestGetBuiltinPrivilegesAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestGetBuiltinPrivilegesAction.java @@ -11,7 +11,6 @@ import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -22,10 +21,8 @@ import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; /** @@ -38,8 +35,8 @@ public RestGetBuiltinPrivilegesAction(Settings settings, XPackLicenseState licen } @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_security/privilege/_builtin", singletonList(GET)); + public List handledRoutes() { + return singletonList(new Route("/_security/privilege/_builtin", GET)); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestGetPrivilegesAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestGetPrivilegesAction.java index d1afe23409db5..a797822a3e542 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestGetPrivilegesAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestGetPrivilegesAction.java @@ -15,7 +15,6 @@ import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -46,18 +45,18 @@ public RestGetPrivilegesAction(Settings settings, XPackLicenseState licenseState } @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.unmodifiableList(Arrays.asList( - new ReplacedRestApi(GET, "/_security/privilege/", GET, "/_xpack/security/privilege/", deprecationLogger), - new ReplacedRestApi(GET, "/_security/privilege/{application}", + new ReplacedRoute(GET, "/_security/privilege/", GET, "/_xpack/security/privilege/", deprecationLogger), + new ReplacedRoute(GET, "/_security/privilege/{application}", GET, "/_xpack/security/privilege/{application}", deprecationLogger), - new ReplacedRestApi(GET, "/_security/privilege/{application}/{privilege}", + new ReplacedRoute(GET, "/_security/privilege/{application}/{privilege}", GET, "/_xpack/security/privilege/{application}/{privilege}", deprecationLogger) )); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestPutPrivilegesAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestPutPrivilegesAction.java index c578819739d39..cd3999e6b300a 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestPutPrivilegesAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestPutPrivilegesAction.java @@ -13,7 +13,6 @@ import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -44,16 +43,16 @@ public RestPutPrivilegesAction(Settings settings, XPackLicenseState licenseState } @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.unmodifiableList(Arrays.asList( - new ReplacedRestApi(PUT, "/_security/privilege/", PUT, "/_xpack/security/privilege/", deprecationLogger), - new ReplacedRestApi(POST, "/_security/privilege/", POST, "/_xpack/security/privilege/", deprecationLogger) + new ReplacedRoute(PUT, "/_security/privilege/", PUT, "/_xpack/security/privilege/", deprecationLogger), + new ReplacedRoute(POST, "/_security/privilege/", POST, "/_xpack/security/privilege/", deprecationLogger) )); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/realm/RestClearRealmCacheAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/realm/RestClearRealmCacheAction.java index 72bfd150a9757..035c9aa3c0766 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/realm/RestClearRealmCacheAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/realm/RestClearRealmCacheAction.java @@ -11,7 +11,6 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestActions.NodesResponseRestListener; import org.elasticsearch.xpack.core.security.action.realm.ClearRealmCacheAction; import org.elasticsearch.xpack.core.security.action.realm.ClearRealmCacheRequest; @@ -19,7 +18,6 @@ import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -32,15 +30,15 @@ public RestClearRealmCacheAction(Settings settings, XPackLicenseState licenseSta } @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.singletonList( - new ReplacedRestApi(POST, "/_security/realm/{realms}/_clear_cache", + new ReplacedRoute(POST, "/_security/realm/{realms}/_clear_cache", POST, "/_xpack/security/realm/{realms}/_clear_cache", deprecationLogger) ); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestClearRolesCacheAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestClearRolesCacheAction.java index 7be9b8dd498d9..1ea1378014457 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestClearRolesCacheAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestClearRolesCacheAction.java @@ -11,7 +11,6 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestActions.NodesResponseRestListener; import org.elasticsearch.xpack.core.security.action.role.ClearRolesCacheAction; import org.elasticsearch.xpack.core.security.action.role.ClearRolesCacheRequest; @@ -19,7 +18,6 @@ import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -32,14 +30,14 @@ public RestClearRolesCacheAction(Settings settings, XPackLicenseState licenseSta } @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 - return Collections.singletonList(new ReplacedRestApi(POST, "/_security/role/{name}/_clear_cache", POST, + return Collections.singletonList(new ReplacedRoute(POST, "/_security/role/{name}/_clear_cache", POST, "/_xpack/security/role/{name}/_clear_cache", deprecationLogger)); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestDeleteRoleAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestDeleteRoleAction.java index 775dd1c60a0b5..cd631f126d010 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestDeleteRoleAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestDeleteRoleAction.java @@ -13,7 +13,6 @@ import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -24,7 +23,6 @@ import java.io.IOException; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.DELETE; @@ -40,14 +38,14 @@ public RestDeleteRoleAction(Settings settings, XPackLicenseState licenseState) { } @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 - return Collections.singletonList(new ReplacedRestApi(DELETE, "/_security/role/{name}", DELETE, + return Collections.singletonList(new ReplacedRoute(DELETE, "/_security/role/{name}", DELETE, "/_xpack/security/role/{name}", deprecationLogger)); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestGetRolesAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestGetRolesAction.java index 4ed1e2bc5f85f..aed1718c8f419 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestGetRolesAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestGetRolesAction.java @@ -14,7 +14,6 @@ import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -27,7 +26,6 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.GET; @@ -43,16 +41,16 @@ public RestGetRolesAction(Settings settings, XPackLicenseState licenseState) { } @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.unmodifiableList(Arrays.asList( - new ReplacedRestApi(GET, "/_security/role/", GET, "/_xpack/security/role/", deprecationLogger), - new ReplacedRestApi(GET, "/_security/role/{name}", GET, "/_xpack/security/role/{name}", deprecationLogger) + new ReplacedRoute(GET, "/_security/role/", GET, "/_xpack/security/role/", deprecationLogger), + new ReplacedRoute(GET, "/_security/role/{name}", GET, "/_xpack/security/role/{name}", deprecationLogger) )); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestPutRoleAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestPutRoleAction.java index ad9513d1dd050..01379ff578a69 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestPutRoleAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestPutRoleAction.java @@ -13,7 +13,6 @@ import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -25,7 +24,6 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.RestRequest.Method.PUT; @@ -42,16 +40,16 @@ public RestPutRoleAction(Settings settings, XPackLicenseState licenseState) { } @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.unmodifiableList(Arrays.asList( - new ReplacedRestApi(POST, "/_security/role/{name}", POST, "/_xpack/security/role/{name}", deprecationLogger), - new ReplacedRestApi(PUT, "/_security/role/{name}", PUT, "/_xpack/security/role/{name}", deprecationLogger) + new ReplacedRoute(POST, "/_security/role/{name}", POST, "/_xpack/security/role/{name}", deprecationLogger), + new ReplacedRoute(PUT, "/_security/role/{name}", PUT, "/_xpack/security/role/{name}", deprecationLogger) )); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/rolemapping/RestDeleteRoleMappingAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/rolemapping/RestDeleteRoleMappingAction.java index 43d9987268012..a889ae1625c58 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/rolemapping/RestDeleteRoleMappingAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/rolemapping/RestDeleteRoleMappingAction.java @@ -13,7 +13,6 @@ import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -24,7 +23,6 @@ import java.io.IOException; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.DELETE; @@ -41,15 +39,15 @@ public RestDeleteRoleMappingAction(Settings settings, XPackLicenseState licenseS } @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.singletonList( - new ReplacedRestApi(DELETE, "/_security/role_mapping/{name}", DELETE, "/_xpack/security/role_mapping/{name}", deprecationLogger) + new ReplacedRoute(DELETE, "/_security/role_mapping/{name}", DELETE, "/_xpack/security/role_mapping/{name}", deprecationLogger) ); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/rolemapping/RestGetRoleMappingsAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/rolemapping/RestGetRoleMappingsAction.java index cefd6c960e474..74831b725cff8 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/rolemapping/RestGetRoleMappingsAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/rolemapping/RestGetRoleMappingsAction.java @@ -13,7 +13,6 @@ import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -26,7 +25,6 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.GET; @@ -42,16 +40,16 @@ public RestGetRoleMappingsAction(Settings settings, XPackLicenseState licenseSta } @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.unmodifiableList(Arrays.asList( - new ReplacedRestApi(GET, "/_security/role_mapping/", GET, "/_xpack/security/role_mapping/", deprecationLogger), - new ReplacedRestApi(GET, "/_security/role_mapping/{name}", GET, "/_xpack/security/role_mapping/{name}", deprecationLogger) + new ReplacedRoute(GET, "/_security/role_mapping/", GET, "/_xpack/security/role_mapping/", deprecationLogger), + new ReplacedRoute(GET, "/_security/role_mapping/{name}", GET, "/_xpack/security/role_mapping/{name}", deprecationLogger) )); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/rolemapping/RestPutRoleMappingAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/rolemapping/RestPutRoleMappingAction.java index df20c71c7ebe9..1e442e31493d0 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/rolemapping/RestPutRoleMappingAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/rolemapping/RestPutRoleMappingAction.java @@ -13,7 +13,6 @@ import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -25,7 +24,6 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.RestRequest.Method.PUT; @@ -44,16 +42,16 @@ public RestPutRoleMappingAction(Settings settings, XPackLicenseState licenseStat } @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.unmodifiableList(Arrays.asList( - new ReplacedRestApi(POST, "/_security/role_mapping/{name}", POST, "/_xpack/security/role_mapping/{name}", deprecationLogger), - new ReplacedRestApi(PUT, "/_security/role_mapping/{name}", PUT, "/_xpack/security/role_mapping/{name}", deprecationLogger) + new ReplacedRoute(POST, "/_security/role_mapping/{name}", POST, "/_xpack/security/role_mapping/{name}", deprecationLogger), + new ReplacedRoute(PUT, "/_security/role_mapping/{name}", PUT, "/_xpack/security/role_mapping/{name}", deprecationLogger) )); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/saml/RestSamlAuthenticateAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/saml/RestSamlAuthenticateAction.java index 3111fa3070135..2bee3f877d7be 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/saml/RestSamlAuthenticateAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/saml/RestSamlAuthenticateAction.java @@ -18,7 +18,6 @@ import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -29,7 +28,6 @@ import java.util.Base64; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -69,15 +67,15 @@ public RestSamlAuthenticateAction(Settings settings, XPackLicenseState licenseSt } @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.singletonList( - new ReplacedRestApi(POST, "/_security/saml/authenticate", + new ReplacedRoute(POST, "/_security/saml/authenticate", POST, "/_xpack/security/saml/authenticate", deprecationLogger) ); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/saml/RestSamlInvalidateSessionAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/saml/RestSamlInvalidateSessionAction.java index 7734e2f25e137..e9301da6fb239 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/saml/RestSamlInvalidateSessionAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/saml/RestSamlInvalidateSessionAction.java @@ -16,7 +16,6 @@ import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -27,7 +26,6 @@ import java.io.IOException; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -53,15 +51,15 @@ public RestSamlInvalidateSessionAction(Settings settings, XPackLicenseState lice } @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.singletonList( - new ReplacedRestApi(POST, "/_security/saml/invalidate", + new ReplacedRoute(POST, "/_security/saml/invalidate", POST, "/_xpack/security/saml/invalidate", deprecationLogger) ); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/saml/RestSamlLogoutAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/saml/RestSamlLogoutAction.java index a40ce0cd4c069..2479f8469a74c 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/saml/RestSamlLogoutAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/saml/RestSamlLogoutAction.java @@ -16,7 +16,6 @@ import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -27,7 +26,6 @@ import java.io.IOException; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -52,15 +50,15 @@ public RestSamlLogoutAction(Settings settings, XPackLicenseState licenseState) { } @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.singletonList( - new ReplacedRestApi(POST, "/_security/saml/logout", + new ReplacedRoute(POST, "/_security/saml/logout", POST, "/_xpack/security/saml/logout", deprecationLogger) ); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/saml/RestSamlPrepareAuthenticationAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/saml/RestSamlPrepareAuthenticationAction.java index 02b2a4c9a2a3a..a0fe86827b49d 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/saml/RestSamlPrepareAuthenticationAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/saml/RestSamlPrepareAuthenticationAction.java @@ -16,7 +16,6 @@ import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -27,7 +26,6 @@ import java.io.IOException; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -55,15 +53,15 @@ public RestSamlPrepareAuthenticationAction(Settings settings, XPackLicenseState } @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.singletonList( - new ReplacedRestApi(POST, "/_security/saml/prepare", + new ReplacedRoute(POST, "/_security/saml/prepare", POST, "/_xpack/security/saml/prepare", deprecationLogger) ); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestChangePasswordAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestChangePasswordAction.java index 6bf518830bce5..08f8224073d47 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestChangePasswordAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestChangePasswordAction.java @@ -14,7 +14,6 @@ import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -31,7 +30,6 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; -import java.util.Map; import java.util.Set; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -50,21 +48,21 @@ public RestChangePasswordAction(Settings settings, SecurityContext securityConte } @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.unmodifiableList(Arrays.asList( - new ReplacedRestApi(PUT, "/_security/user/{username}/_password", + new ReplacedRoute(PUT, "/_security/user/{username}/_password", PUT, "/_xpack/security/user/{username}/_password", deprecationLogger), - new ReplacedRestApi(POST, "/_security/user/{username}/_password", + new ReplacedRoute(POST, "/_security/user/{username}/_password", POST, "/_xpack/security/user/{username}/_password", deprecationLogger), - new ReplacedRestApi(PUT, "/_security/user/_password", + new ReplacedRoute(PUT, "/_security/user/_password", PUT, "/_xpack/security/user/_password", deprecationLogger), - new ReplacedRestApi(POST, "/_security/user/_password", + new ReplacedRoute(POST, "/_security/user/_password", POST, "/_xpack/security/user/_password", deprecationLogger) )); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestDeleteUserAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestDeleteUserAction.java index 0dd57b26e1f1a..0544cde8c583d 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestDeleteUserAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestDeleteUserAction.java @@ -13,7 +13,6 @@ import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -24,7 +23,6 @@ import java.io.IOException; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.DELETE; @@ -40,15 +38,15 @@ public RestDeleteUserAction(Settings settings, XPackLicenseState licenseState) { } @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.singletonList( - new ReplacedRestApi(DELETE, "/_security/user/{username}", DELETE, "/_xpack/security/user/{username}", deprecationLogger) + new ReplacedRoute(DELETE, "/_security/user/{username}", DELETE, "/_xpack/security/user/{username}", deprecationLogger) ); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestGetUserPrivilegesAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestGetUserPrivilegesAction.java index fcd9eb6346cbe..a25c76c83bc5d 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestGetUserPrivilegesAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestGetUserPrivilegesAction.java @@ -16,7 +16,6 @@ import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -32,7 +31,6 @@ import java.io.IOException; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.GET; @@ -51,15 +49,15 @@ public RestGetUserPrivilegesAction(Settings settings, SecurityContext securityCo } @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.singletonList( - new ReplacedRestApi(GET, "/_security/user/_privileges", GET, "/_xpack/security/user/_privileges", deprecationLogger) + new ReplacedRoute(GET, "/_security/user/_privileges", GET, "/_xpack/security/user/_privileges", deprecationLogger) ); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestGetUsersAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestGetUsersAction.java index 1a842af3d66f9..a06f4ad836cf1 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestGetUsersAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestGetUsersAction.java @@ -14,7 +14,6 @@ import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -27,7 +26,6 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.GET; @@ -43,16 +41,16 @@ public RestGetUsersAction(Settings settings, XPackLicenseState licenseState) { } @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.unmodifiableList(Arrays.asList( - new ReplacedRestApi(GET, "/_security/user/", GET, "/_xpack/security/user/", deprecationLogger), - new ReplacedRestApi(GET, "/_security/user/{username}", GET, "/_xpack/security/user/{username}", deprecationLogger) + new ReplacedRoute(GET, "/_security/user/", GET, "/_xpack/security/user/", deprecationLogger), + new ReplacedRoute(GET, "/_security/user/{username}", GET, "/_xpack/security/user/{username}", deprecationLogger) )); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestHasPrivilegesAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestHasPrivilegesAction.java index 2bce3b6dbcf8f..0c6fabbb5c332 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestHasPrivilegesAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestHasPrivilegesAction.java @@ -18,7 +18,6 @@ import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -33,7 +32,6 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -53,21 +51,21 @@ public RestHasPrivilegesAction(Settings settings, SecurityContext securityContex } @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.unmodifiableList(Arrays.asList( - new ReplacedRestApi(GET, "/_security/user/{username}/_has_privileges", + new ReplacedRoute(GET, "/_security/user/{username}/_has_privileges", GET, "/_xpack/security/user/{username}/_has_privileges", deprecationLogger), - new ReplacedRestApi(POST, "/_security/user/{username}/_has_privileges", + new ReplacedRoute(POST, "/_security/user/{username}/_has_privileges", POST, "/_xpack/security/user/{username}/_has_privileges", deprecationLogger), - new ReplacedRestApi(GET, "/_security/user/_has_privileges", + new ReplacedRoute(GET, "/_security/user/_has_privileges", GET, "/_xpack/security/user/_has_privileges", deprecationLogger), - new ReplacedRestApi(POST, "/_security/user/_has_privileges", + new ReplacedRoute(POST, "/_security/user/_has_privileges", POST, "/_xpack/security/user/_has_privileges", deprecationLogger) )); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestPutUserAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestPutUserAction.java index 18d70177775ec..5e17552ab6d33 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestPutUserAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestPutUserAction.java @@ -14,7 +14,6 @@ import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -29,7 +28,6 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; -import java.util.Map; import java.util.Set; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -49,17 +47,17 @@ public RestPutUserAction(Settings settings, XPackLicenseState licenseState) { } @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.unmodifiableList(Arrays.asList( - new ReplacedRestApi(POST, "/_security/user/{username}", + new ReplacedRoute(POST, "/_security/user/{username}", POST, "/_xpack/security/user/{username}", deprecationLogger), - new ReplacedRestApi(PUT, "/_security/user/{username}", + new ReplacedRoute(PUT, "/_security/user/{username}", PUT, "/_xpack/security/user/{username}", deprecationLogger) )); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestSetEnabledAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestSetEnabledAction.java index 30422a0275f46..b818a69384757 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestSetEnabledAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestSetEnabledAction.java @@ -13,7 +13,6 @@ import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -25,7 +24,6 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; -import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.RestRequest.Method.PUT; @@ -43,21 +41,21 @@ public RestSetEnabledAction(Settings settings, XPackLicenseState licenseState) { } @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List replacedMethodsAndPaths() { + public List replacedRoutes() { // TODO: remove deprecated endpoint in 8.0.0 return Collections.unmodifiableList(Arrays.asList( - new ReplacedRestApi(POST, "/_security/user/{username}/_enable", + new ReplacedRoute(POST, "/_security/user/{username}/_enable", POST, "/_xpack/security/user/{username}/_enable", deprecationLogger), - new ReplacedRestApi(PUT, "/_security/user/{username}/_enable", + new ReplacedRoute(PUT, "/_security/user/{username}/_enable", PUT, "/_xpack/security/user/{username}/_enable", deprecationLogger), - new ReplacedRestApi(POST, "/_security/user/{username}/_disable", + new ReplacedRoute(POST, "/_security/user/{username}/_disable", POST, "/_xpack/security/user/{username}/_disable", deprecationLogger), - new ReplacedRestApi(PUT, "/_security/user/{username}/_disable", + new ReplacedRoute(PUT, "/_security/user/{username}/_disable", PUT, "/_xpack/security/user/{username}/_disable", deprecationLogger) )); } diff --git a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/rest/action/SecurityBaseRestHandlerTests.java b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/rest/action/SecurityBaseRestHandlerTests.java index 4318be0cc965f..f0557fd68a079 100644 --- a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/rest/action/SecurityBaseRestHandlerTests.java +++ b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/rest/action/SecurityBaseRestHandlerTests.java @@ -10,7 +10,6 @@ import org.elasticsearch.license.License; import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.rest.FakeRestChannel; import org.elasticsearch.test.rest.FakeRestRequest; @@ -18,7 +17,6 @@ import java.io.IOException; import java.util.Collections; import java.util.List; -import java.util.Map; import java.util.concurrent.atomic.AtomicBoolean; import static org.mockito.Mockito.mock; @@ -44,8 +42,8 @@ public String getName() { } @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override diff --git a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/rest/action/saml/SamlBaseRestHandlerTests.java b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/rest/action/saml/SamlBaseRestHandlerTests.java index dbc1e57665d89..4035ff0a8d16b 100644 --- a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/rest/action/saml/SamlBaseRestHandlerTests.java +++ b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/rest/action/saml/SamlBaseRestHandlerTests.java @@ -12,7 +12,6 @@ import org.elasticsearch.license.LicenseUtils; import org.elasticsearch.license.TestUtils; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.rest.FakeRestRequest; import org.elasticsearch.xpack.core.XPackSettings; @@ -20,7 +19,6 @@ import java.util.Collections; import java.util.List; -import java.util.Map; import static org.hamcrest.Matchers.contains; import static org.hamcrest.Matchers.instanceOf; @@ -56,8 +54,8 @@ public String getName() { } @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlClearCursorAction.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlClearCursorAction.java index 092779b0b8d90..f0be77701ea27 100644 --- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlClearCursorAction.java +++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlClearCursorAction.java @@ -10,7 +10,6 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.sql.action.SqlClearCursorAction; import org.elasticsearch.xpack.sql.action.SqlClearCursorRequest; @@ -18,17 +17,15 @@ import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestSqlClearCursorAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap(Protocol.CLEAR_CURSOR_REST_ENDPOINT, singletonList(POST)); + public List handledRoutes() { + return singletonList(new Route(Protocol.CLEAR_CURSOR_REST_ENDPOINT, POST)); } @Override diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlQueryAction.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlQueryAction.java index 990687171bc39..0659d59c4e2a6 100644 --- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlQueryAction.java +++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlQueryAction.java @@ -13,7 +13,6 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestResponseListener; @@ -26,10 +25,8 @@ import java.io.IOException; import java.nio.charset.StandardCharsets; import java.util.List; -import java.util.Map; import static java.util.Arrays.asList; -import static java.util.Collections.singletonMap; import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -37,8 +34,10 @@ public class RestSqlQueryAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap(Protocol.SQL_QUERY_REST_ENDPOINT, unmodifiableList(asList(GET, POST))); + public List handledRoutes() { + return unmodifiableList(asList( + new Route(Protocol.SQL_QUERY_REST_ENDPOINT, GET), + new Route(Protocol.SQL_QUERY_REST_ENDPOINT, POST))); } @Override diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlStatsAction.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlStatsAction.java index 830dfe020ea27..3324d3058a81a 100644 --- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlStatsAction.java +++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlStatsAction.java @@ -9,22 +9,19 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestActions; import org.elasticsearch.xpack.sql.proto.Protocol; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestSqlStatsAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap(Protocol.SQL_STATS_REST_ENDPOINT, singletonList(GET)); + public List handledRoutes() { + return singletonList(new Route(Protocol.SQL_STATS_REST_ENDPOINT, GET)); } @Override diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlTranslateAction.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlTranslateAction.java index e3e8b389e2ad0..540028c4351ac 100644 --- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlTranslateAction.java +++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlTranslateAction.java @@ -9,7 +9,6 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.sql.action.SqlTranslateAction; import org.elasticsearch.xpack.sql.action.SqlTranslateRequest; @@ -17,10 +16,8 @@ import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Arrays.asList; -import static java.util.Collections.singletonMap; import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -31,8 +28,10 @@ public class RestSqlTranslateAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap(Protocol.SQL_TRANSLATE_REST_ENDPOINT, unmodifiableList(asList(GET, POST))); + public List handledRoutes() { + return unmodifiableList(asList( + new Route(Protocol.SQL_TRANSLATE_REST_ENDPOINT, GET), + new Route(Protocol.SQL_TRANSLATE_REST_ENDPOINT, POST))); } @Override diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestDeleteTransformAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestDeleteTransformAction.java index 157118d03c99d..f984fe071e5d4 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestDeleteTransformAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestDeleteTransformAction.java @@ -9,23 +9,20 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.transform.TransformField; import org.elasticsearch.xpack.core.transform.action.DeleteTransformAction; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.DELETE; public class RestDeleteTransformAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID, singletonList(DELETE)); + public List handledRoutes() { + return singletonList(new Route(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID, DELETE)); } @Override diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestGetTransformAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestGetTransformAction.java index 0151609a8cca4..dca3534832cb1 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestGetTransformAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestGetTransformAction.java @@ -7,31 +7,27 @@ package org.elasticsearch.xpack.transform.rest.action; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.action.util.PageParams; import org.elasticsearch.xpack.core.transform.TransformField; import org.elasticsearch.xpack.core.transform.action.GetTransformAction; -import java.util.Collections; import java.util.List; -import java.util.Map; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.xpack.core.transform.TransformField.ALLOW_NO_MATCH; public class RestGetTransformAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put(TransformField.REST_BASE_PATH_TRANSFORMS, singletonList(GET)) - .put(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID, singletonList(GET)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route(TransformField.REST_BASE_PATH_TRANSFORMS, GET), + new Route(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID, GET))); } @Override diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestGetTransformStatsAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestGetTransformStatsAction.java index 90d73d40dfb3a..772b6d8600a82 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestGetTransformStatsAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestGetTransformStatsAction.java @@ -7,31 +7,27 @@ package org.elasticsearch.xpack.transform.rest.action; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.action.util.PageParams; import org.elasticsearch.xpack.core.transform.TransformField; import org.elasticsearch.xpack.core.transform.action.GetTransformStatsAction; -import java.util.Collections; import java.util.List; -import java.util.Map; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.xpack.core.transform.TransformField.ALLOW_NO_MATCH; public class RestGetTransformStatsAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put(TransformField.REST_BASE_PATH_TRANSFORMS + "_stats", singletonList(GET)) - .put(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID + "_stats", singletonList(GET)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route(TransformField.REST_BASE_PATH_TRANSFORMS + "_stats", GET), + new Route(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID + "_stats", GET))); } @Override diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestPreviewTransformAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestPreviewTransformAction.java index b2d1f28a8945e..442d88865f89a 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestPreviewTransformAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestPreviewTransformAction.java @@ -10,24 +10,21 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.transform.TransformField; import org.elasticsearch.xpack.core.transform.action.PreviewTransformAction; import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestPreviewTransformAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap(TransformField.REST_BASE_PATH_TRANSFORMS + "_preview", singletonList(POST)); + public List handledRoutes() { + return singletonList(new Route(TransformField.REST_BASE_PATH_TRANSFORMS + "_preview", POST)); } @Override diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestPutTransformAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestPutTransformAction.java index 1992841104aa9..91d6c5f5160b4 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestPutTransformAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestPutTransformAction.java @@ -10,24 +10,21 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.transform.TransformField; import org.elasticsearch.xpack.core.transform.action.PutTransformAction; import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.PUT; public class RestPutTransformAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID, singletonList(PUT)); + public List handledRoutes() { + return singletonList(new Route(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID, PUT)); } @Override diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestStartTransformAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestStartTransformAction.java index 923c2854ab257..de44180a83e8e 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestStartTransformAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestStartTransformAction.java @@ -10,23 +10,20 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.transform.TransformField; import org.elasticsearch.xpack.core.transform.action.StartTransformAction; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestStartTransformAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID + "_start", singletonList(POST)); + public List handledRoutes() { + return singletonList(new Route(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID + "_start", POST)); } @Override diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestStopTransformAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestStopTransformAction.java index d5b6c9855a3f7..edfbadd5f8697 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestStopTransformAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestStopTransformAction.java @@ -9,23 +9,20 @@ import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.transform.TransformField; import org.elasticsearch.xpack.core.transform.action.StopTransformAction; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestStopTransformAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID + "_stop", singletonList(POST)); + public List handledRoutes() { + return singletonList(new Route(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID + "_stop", POST)); } @Override diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestUpdateTransformAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestUpdateTransformAction.java index 1cae8b67f9735..cbfe87749eef5 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestUpdateTransformAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestUpdateTransformAction.java @@ -10,24 +10,21 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.transform.TransformField; import org.elasticsearch.xpack.core.transform.action.UpdateTransformAction; import java.io.IOException; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestUpdateTransformAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID + "_update", singletonList(POST)); + public List handledRoutes() { + return singletonList(new Route(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID + "_update", POST)); } @Override diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestDeleteTransformActionDeprecated.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestDeleteTransformActionDeprecated.java index d4d25628f7d39..0f60faa0a0799 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestDeleteTransformActionDeprecated.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestDeleteTransformActionDeprecated.java @@ -11,7 +11,6 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.transform.TransformField; import org.elasticsearch.xpack.core.transform.TransformMessages; @@ -20,7 +19,6 @@ import java.util.Collections; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; import static org.elasticsearch.rest.RestRequest.Method.DELETE; @@ -31,14 +29,14 @@ public class RestDeleteTransformActionDeprecated extends BaseRestHandler { LogManager.getLogger(RestDeleteTransformActionDeprecated.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List deprecatedHandledMethodsAndPaths() { - return singletonList(new DeprecatedRestApi(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID_DEPRECATED, - singletonList(DELETE), TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger)); + public List deprecatedRoutes() { + return singletonList(new DeprecatedRoute(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID_DEPRECATED, + DELETE, TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger)); } @Override diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestGetTransformActionDeprecated.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestGetTransformActionDeprecated.java index d6520b7838e3b..2a9ac6566d01b 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestGetTransformActionDeprecated.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestGetTransformActionDeprecated.java @@ -11,7 +11,6 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.action.util.PageParams; import org.elasticsearch.xpack.core.transform.TransformField; @@ -21,10 +20,8 @@ import java.util.Collections; import java.util.List; -import java.util.Map; import static java.util.Arrays.asList; -import static java.util.Collections.singletonList; import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.xpack.core.transform.TransformField.ALLOW_NO_MATCH; @@ -35,16 +32,16 @@ public class RestGetTransformActionDeprecated extends BaseRestHandler { LogManager.getLogger(RestGetTransformActionDeprecated.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List deprecatedHandledMethodsAndPaths() { + public List deprecatedRoutes() { return unmodifiableList(asList( - new DeprecatedRestApi(TransformField.REST_BASE_PATH_TRANSFORMS_DEPRECATED, singletonList(GET), + new DeprecatedRoute(TransformField.REST_BASE_PATH_TRANSFORMS_DEPRECATED, GET, TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger), - new DeprecatedRestApi(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID_DEPRECATED, singletonList(GET), + new DeprecatedRoute(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID_DEPRECATED, GET, TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger))); } diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestGetTransformStatsActionDeprecated.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestGetTransformStatsActionDeprecated.java index 96b1efdcf6e2f..68b795c5754e4 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestGetTransformStatsActionDeprecated.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestGetTransformStatsActionDeprecated.java @@ -11,7 +11,6 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.action.util.PageParams; import org.elasticsearch.xpack.core.transform.TransformField; @@ -21,10 +20,8 @@ import java.util.Collections; import java.util.List; -import java.util.Map; import static java.util.Arrays.asList; -import static java.util.Collections.singletonList; import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.xpack.core.transform.TransformField.ALLOW_NO_MATCH; @@ -35,16 +32,16 @@ public class RestGetTransformStatsActionDeprecated extends BaseRestHandler { LogManager.getLogger(RestGetTransformStatsActionDeprecated.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List deprecatedHandledMethodsAndPaths() { + public List deprecatedRoutes() { return unmodifiableList(asList( - new DeprecatedRestApi(TransformField.REST_BASE_PATH_TRANSFORMS_DEPRECATED + "_stats", singletonList(GET), + new DeprecatedRoute(TransformField.REST_BASE_PATH_TRANSFORMS_DEPRECATED + "_stats", GET, TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger), - new DeprecatedRestApi(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID_DEPRECATED + "_stats", singletonList(GET), + new DeprecatedRoute(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID_DEPRECATED + "_stats", GET, TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger))); } diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestPreviewTransformActionDeprecated.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestPreviewTransformActionDeprecated.java index 784afc85e738d..c6691b59b58fa 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestPreviewTransformActionDeprecated.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestPreviewTransformActionDeprecated.java @@ -12,7 +12,6 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.transform.TransformField; import org.elasticsearch.xpack.core.transform.TransformMessages; @@ -22,7 +21,6 @@ import java.io.IOException; import java.util.Collections; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -33,14 +31,14 @@ public class RestPreviewTransformActionDeprecated extends BaseRestHandler { LogManager.getLogger(RestPreviewTransformActionDeprecated.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List deprecatedHandledMethodsAndPaths() { - return singletonList(new DeprecatedRestApi(TransformField.REST_BASE_PATH_TRANSFORMS_DEPRECATED + "_preview", - singletonList(POST), TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger)); + public List deprecatedRoutes() { + return singletonList(new DeprecatedRoute(TransformField.REST_BASE_PATH_TRANSFORMS_DEPRECATED + "_preview", + POST, TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger)); } @Override diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestPutTransformActionDeprecated.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestPutTransformActionDeprecated.java index a5ebec79f6bdc..9159c284d109f 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestPutTransformActionDeprecated.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestPutTransformActionDeprecated.java @@ -12,7 +12,6 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.transform.TransformField; import org.elasticsearch.xpack.core.transform.TransformMessages; @@ -22,7 +21,6 @@ import java.io.IOException; import java.util.Collections; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; import static org.elasticsearch.rest.RestRequest.Method.PUT; @@ -33,13 +31,13 @@ public class RestPutTransformActionDeprecated extends BaseRestHandler { LogManager.getLogger(RestPutTransformActionDeprecated.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List deprecatedHandledMethodsAndPaths() { - return singletonList(new DeprecatedRestApi(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID_DEPRECATED, singletonList(PUT), + public List deprecatedRoutes() { + return singletonList(new DeprecatedRoute(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID_DEPRECATED, PUT, TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger)); } diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestStartTransformActionDeprecated.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestStartTransformActionDeprecated.java index 326827d652e25..c665c4ca991e4 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestStartTransformActionDeprecated.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestStartTransformActionDeprecated.java @@ -12,7 +12,6 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.transform.TransformField; import org.elasticsearch.xpack.core.transform.TransformMessages; @@ -21,7 +20,6 @@ import java.util.Collections; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -32,14 +30,14 @@ public class RestStartTransformActionDeprecated extends BaseRestHandler { LogManager.getLogger(RestStartTransformActionDeprecated.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List deprecatedHandledMethodsAndPaths() { - return singletonList(new DeprecatedRestApi(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID_DEPRECATED + "_start", - singletonList(POST), TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger)); + public List deprecatedRoutes() { + return singletonList(new DeprecatedRoute(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID_DEPRECATED + "_start", + POST, TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger)); } @Override diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestStopTransformActionDeprecated.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestStopTransformActionDeprecated.java index 637100fc5abc0..3335a41d00298 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestStopTransformActionDeprecated.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestStopTransformActionDeprecated.java @@ -11,7 +11,6 @@ import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.transform.TransformField; import org.elasticsearch.xpack.core.transform.TransformMessages; @@ -20,7 +19,6 @@ import java.util.Collections; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -31,13 +29,13 @@ public class RestStopTransformActionDeprecated extends BaseRestHandler { LogManager.getLogger(RestStopTransformActionDeprecated.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List deprecatedHandledMethodsAndPaths() { - return singletonList(new DeprecatedRestApi(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID_DEPRECATED + "_stop", singletonList(POST), + public List deprecatedRoutes() { + return singletonList(new DeprecatedRoute(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID_DEPRECATED + "_stop", POST, TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger)); } diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestUpdateTransformActionDeprecated.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestUpdateTransformActionDeprecated.java index 48bc7a4d028ba..63a68f71a8ac5 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestUpdateTransformActionDeprecated.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestUpdateTransformActionDeprecated.java @@ -12,7 +12,6 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.transform.TransformField; import org.elasticsearch.xpack.core.transform.TransformMessages; @@ -22,7 +21,6 @@ import java.io.IOException; import java.util.Collections; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -33,14 +31,14 @@ public class RestUpdateTransformActionDeprecated extends BaseRestHandler { LogManager.getLogger(RestUpdateTransformActionDeprecated.class)); @Override - public Map> handledMethodsAndPaths() { - return Collections.emptyMap(); + public List handledRoutes() { + return Collections.emptyList(); } @Override - public List deprecatedHandledMethodsAndPaths() { - return singletonList(new DeprecatedRestApi(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID_DEPRECATED + "_update", - singletonList(POST), TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger)); + public List deprecatedRoutes() { + return singletonList(new DeprecatedRoute(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID_DEPRECATED + "_update", + POST, TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger)); } @Override diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestAckWatchAction.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestAckWatchAction.java index 057be3afc3ab9..04dba0903a860 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestAckWatchAction.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestAckWatchAction.java @@ -7,12 +7,10 @@ package org.elasticsearch.xpack.watcher.rest.action; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -22,9 +20,7 @@ import org.elasticsearch.xpack.core.watcher.transport.actions.ack.AckWatchResponse; import org.elasticsearch.xpack.core.watcher.watch.WatchField; -import java.util.Collections; import java.util.List; -import java.util.Map; import static java.util.Arrays.asList; import static java.util.Collections.unmodifiableList; @@ -37,11 +33,12 @@ public class RestAckWatchAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_watcher/watch/{id}/_ack", unmodifiableList(asList(POST, PUT))) - .put("/_watcher/watch/{id}/_ack/{actions}", unmodifiableList(asList(POST, PUT))) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_watcher/watch/{id}/_ack", POST), + new Route("/_watcher/watch/{id}/_ack", PUT), + new Route("/_watcher/watch/{id}/_ack/{actions}", POST), + new Route("/_watcher/watch/{id}/_ack/{actions}", PUT))); } @Override diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestActivateWatchAction.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestActivateWatchAction.java index bc0e12db0d58f..066f82e24f4a4 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestActivateWatchAction.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestActivateWatchAction.java @@ -11,7 +11,6 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -22,10 +21,8 @@ import org.elasticsearch.xpack.core.watcher.watch.WatchField; import java.util.List; -import java.util.Map; import static java.util.Arrays.asList; -import static java.util.Collections.singletonMap; import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.RestRequest.Method.PUT; @@ -36,8 +33,10 @@ public class RestActivateWatchAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_watcher/watch/{id}/_activate", unmodifiableList(asList(POST, PUT))); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_watcher/watch/{id}/_activate", POST), + new Route("/_watcher/watch/{id}/_activate", PUT))); } @Override @@ -63,8 +62,10 @@ public RestResponse buildResponse(ActivateWatchResponse response, XContentBuilde public static class DeactivateRestHandler extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_watcher/watch/{id}/_deactivate", unmodifiableList(asList(POST, PUT))); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_watcher/watch/{id}/_deactivate", POST), + new Route("/_watcher/watch/{id}/_deactivate", PUT))); } @Override diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestDeleteWatchAction.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestDeleteWatchAction.java index 0a992f5d8d200..47c2e9c01641c 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestDeleteWatchAction.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestDeleteWatchAction.java @@ -13,17 +13,14 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; import org.elasticsearch.xpack.core.watcher.transport.actions.delete.DeleteWatchAction; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.DELETE; import static org.elasticsearch.rest.RestStatus.NOT_FOUND; import static org.elasticsearch.rest.RestStatus.OK; @@ -31,8 +28,8 @@ public class RestDeleteWatchAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_watcher/watch/{id}", singletonList(DELETE)); + public List handledRoutes() { + return singletonList(new Route("/_watcher/watch/{id}", DELETE)); } @Override diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestExecuteWatchAction.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestExecuteWatchAction.java index 6feb2825a02aa..df1bcf54d4431 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestExecuteWatchAction.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestExecuteWatchAction.java @@ -10,14 +10,12 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.ParseField; import org.elasticsearch.common.bytes.BytesReference; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.util.set.Sets; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -33,7 +31,6 @@ import java.io.IOException; import java.util.Collections; import java.util.List; -import java.util.Map; import java.util.Set; import static java.util.Arrays.asList; @@ -52,11 +49,12 @@ public class RestExecuteWatchAction extends BaseRestHandler implements RestReque WatchField.METADATA.getPreferredName(), WatchField.STATUS.getPreferredName()); @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_watcher/watch/{id}/_execute", unmodifiableList(asList(POST, PUT))) - .put("/_watcher/watch/_execute", unmodifiableList(asList(POST, PUT))) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_watcher/watch/{id}/_execute", POST), + new Route("/_watcher/watch/{id}/_execute", PUT), + new Route("/_watcher/watch/_execute", POST), + new Route("/_watcher/watch/_execute", PUT))); } @Override diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestGetWatchAction.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestGetWatchAction.java index 13517c268c387..e4a287431b663 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestGetWatchAction.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestGetWatchAction.java @@ -11,7 +11,6 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -20,10 +19,8 @@ import org.elasticsearch.xpack.core.watcher.transport.actions.get.GetWatchResponse; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestStatus.NOT_FOUND; import static org.elasticsearch.rest.RestStatus.OK; @@ -31,8 +28,8 @@ public class RestGetWatchAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_watcher/watch/{id}", singletonList(GET)); + public List handledRoutes() { + return singletonList(new Route("/_watcher/watch/{id}", GET)); } @Override diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestPutWatchAction.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestPutWatchAction.java index dc4fc1c859909..068cf945a9253 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestPutWatchAction.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestPutWatchAction.java @@ -15,7 +15,6 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; @@ -24,11 +23,9 @@ import java.util.Collections; import java.util.List; -import java.util.Map; import java.util.Set; import static java.util.Arrays.asList; -import static java.util.Collections.singletonMap; import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.RestRequest.Method.PUT; @@ -38,8 +35,10 @@ public class RestPutWatchAction extends BaseRestHandler implements RestRequestFilter { @Override - public Map> handledMethodsAndPaths() { - return singletonMap("/_watcher/watch/{id}", unmodifiableList(asList(POST, PUT))); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_watcher/watch/{id}", POST), + new Route("/_watcher/watch/{id}", PUT))); } @Override diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatchServiceAction.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatchServiceAction.java index 1aa3fa7c49270..c061feced4afe 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatchServiceAction.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatchServiceAction.java @@ -9,14 +9,11 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.core.watcher.transport.actions.service.WatcherServiceAction; import org.elasticsearch.xpack.core.watcher.transport.actions.service.WatcherServiceRequest; -import java.util.Collections; import java.util.List; -import java.util.Map; import static java.util.Collections.singletonList; import static org.elasticsearch.rest.RestRequest.Method.POST; @@ -24,8 +21,8 @@ public class RestWatchServiceAction extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.singletonMap("/_watcher/_start", singletonList(POST)); + public List handledRoutes() { + return singletonList(new Route("/_watcher/_start", POST)); } @Override @@ -42,8 +39,8 @@ public RestChannelConsumer prepareRequest(RestRequest request, NodeClient client public static class StopRestHandler extends BaseRestHandler { @Override - public Map> handledMethodsAndPaths() { - return Collections.singletonMap("/_watcher/_stop", singletonList(POST)); + public List handledRoutes() { + return singletonList(new Route("/_watcher/_stop", POST)); } @Override diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatcherStatsAction.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatcherStatsAction.java index 3d6f46a2ba3c8..641f4b36e371c 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatcherStatsAction.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatcherStatsAction.java @@ -10,21 +10,19 @@ import org.apache.logging.log4j.Logger; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; import org.elasticsearch.rest.action.RestActions; import org.elasticsearch.xpack.core.watcher.transport.actions.stats.WatcherStatsAction; import org.elasticsearch.xpack.core.watcher.transport.actions.stats.WatcherStatsRequest; import java.util.Collections; import java.util.List; -import java.util.Map; import java.util.Set; -import static java.util.Collections.singletonList; +import static java.util.Arrays.asList; +import static java.util.Collections.unmodifiableList; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestWatcherStatsAction extends BaseRestHandler { @@ -32,11 +30,10 @@ public class RestWatcherStatsAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(logger); @Override - public Map> handledMethodsAndPaths() { - return Collections.unmodifiableMap(MapBuilder.>newMapBuilder() - .put("/_watcher/stats", singletonList(GET)) - .put("/_watcher/stats/{metric}", singletonList(GET)) - .map()); + public List handledRoutes() { + return unmodifiableList(asList( + new Route("/_watcher/stats", GET), + new Route("/_watcher/stats/{metric}", GET))); } @Override From 94f112444465bae74c135a9d16e147ebc215726d Mon Sep 17 00:00:00 2001 From: jaymode Date: Thu, 6 Feb 2020 14:24:01 -0700 Subject: [PATCH 05/11] update javadoc --- .../main/java/org/elasticsearch/rest/RestHandler.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/rest/RestHandler.java b/server/src/main/java/org/elasticsearch/rest/RestHandler.java index f532602c253a0..cc0edc3097fb0 100644 --- a/server/src/main/java/org/elasticsearch/rest/RestHandler.java +++ b/server/src/main/java/org/elasticsearch/rest/RestHandler.java @@ -73,8 +73,8 @@ default List handledRoutes() { } /** - * A list of APIs handled by this RestHandler that are deprecated and do not have a direct - * replacement. If changing the {@code path} or {@code method} of the API, + * A list of routes handled by this RestHandler that are deprecated and do not have a direct + * replacement. If changing the {@code path} or {@code method} of a route, * use {@link #replacedRoutes()}. */ default List deprecatedRoutes() { @@ -82,9 +82,9 @@ default List deprecatedRoutes() { } /** - * A list of APIs handled by this RestHandler that have had their {@code path} and/or - * {@code method} changed. The pre-existing {@code path} and {@code method} will be registered - * as deprecated alongside the updated {@code path} and {@code method}. + * A list of routes handled by this RestHandler that have had their {@code path} and/or + * {@code method} changed. The pre-existing {@code route} will be registered + * as deprecated alongside the updated {@code route}. */ default List replacedRoutes() { return Collections.emptyList(); From 771b4e12948698f98c3098fa1e55567475633761 Mon Sep 17 00:00:00 2001 From: jaymode Date: Thu, 6 Feb 2020 14:41:36 -0700 Subject: [PATCH 06/11] fix duplicated api --- .../rest/action/admin/indices/RestIndexPutAliasAction.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndexPutAliasAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndexPutAliasAction.java index 181458ba695a1..33e801fd94c8f 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndexPutAliasAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndexPutAliasAction.java @@ -51,8 +51,7 @@ public List handledRoutes() { new Route("/_aliases/{name}", PUT), new Route("/{index}/_alias", PUT), new Route("/{index}/_aliases", PUT), - new Route("/_alias", PUT), - new Route("/{index}/_alias", PUT))); + new Route("/_alias", PUT))); } @Override From 2b69b84cd44b19456fbbe1f1ff408b399cddbc3b Mon Sep 17 00:00:00 2001 From: jaymode Date: Fri, 7 Feb 2020 09:40:04 -0700 Subject: [PATCH 07/11] fix new autoscaling handler --- .../elasticsearch/xpack/autoscaling/Autoscaling.java | 2 +- .../rest/RestGetAutoscalingDecisionHandler.java | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/Autoscaling.java b/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/Autoscaling.java index cdfd099eb02c7..46df1ba7730d7 100644 --- a/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/Autoscaling.java +++ b/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/Autoscaling.java @@ -78,7 +78,7 @@ public List getRestHandlers( final Supplier nodesInCluster ) { if (enabled) { - return List.of(new RestGetAutoscalingDecisionHandler(controller)); + return List.of(new RestGetAutoscalingDecisionHandler()); } else { return List.of(); } diff --git a/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/rest/RestGetAutoscalingDecisionHandler.java b/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/rest/RestGetAutoscalingDecisionHandler.java index e8f9674ae6d53..6da492a3f3277 100644 --- a/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/rest/RestGetAutoscalingDecisionHandler.java +++ b/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/rest/RestGetAutoscalingDecisionHandler.java @@ -8,15 +8,20 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.xpack.autoscaling.action.GetAutoscalingDecisionAction; +import java.util.List; + +import static java.util.Collections.singletonList; +import static org.elasticsearch.rest.RestRequest.Method.GET; + public class RestGetAutoscalingDecisionHandler extends BaseRestHandler { - public RestGetAutoscalingDecisionHandler(final RestController controller) { - controller.registerHandler(RestRequest.Method.GET, "/_autoscaling/decision", this); + @Override + public List handledRoutes() { + return singletonList(new Route("/_autoscaling/decision", GET)); } @Override From 265327123f4b59d7775f6ec62fe1622cf12b1bff Mon Sep 17 00:00:00 2001 From: jaymode Date: Fri, 7 Feb 2020 09:42:06 -0700 Subject: [PATCH 08/11] method first then path --- .../noop/action/bulk/RestNoopBulkAction.java | 8 +++---- .../action/search/RestNoopSearchAction.java | 8 +++---- .../ingest/common/GrokProcessorGetAction.java | 2 +- .../RestMultiSearchTemplateAction.java | 8 +++---- .../RestRenderSearchTemplateAction.java | 8 +++---- .../mustache/RestSearchTemplateAction.java | 8 +++---- .../action/PainlessContextAction.java | 2 +- .../action/PainlessExecuteAction.java | 4 ++-- .../index/rankeval/RestRankEvalAction.java | 8 +++---- .../reindex/RestDeleteByQueryAction.java | 2 +- .../index/reindex/RestReindexAction.java | 2 +- .../index/reindex/RestRethrottleAction.java | 6 ++--- .../reindex/RestUpdateByQueryAction.java | 2 +- .../example/resthandler/ExampleCatAction.java | 4 ++-- .../RestDieWithDignityAction.java | 2 +- .../http/TestDeprecationHeaderRestAction.java | 2 +- .../http/TestResponseHeaderRestAction.java | 2 +- .../org/elasticsearch/rest/RestHandler.java | 8 +++---- .../action/RestFieldCapabilitiesAction.java | 8 +++---- .../rest/action/RestMainAction.java | 4 ++-- .../RestAddVotingConfigExclusionAction.java | 2 +- .../admin/cluster/RestCancelTasksAction.java | 4 ++-- .../cluster/RestCleanupRepositoryAction.java | 2 +- ...RestClearVotingConfigExclusionsAction.java | 2 +- .../RestClusterAllocationExplainAction.java | 4 ++-- .../cluster/RestClusterGetSettingsAction.java | 2 +- .../cluster/RestClusterHealthAction.java | 4 ++-- .../cluster/RestClusterRerouteAction.java | 2 +- .../RestClusterSearchShardsAction.java | 8 +++---- .../admin/cluster/RestClusterStateAction.java | 6 ++--- .../admin/cluster/RestClusterStatsAction.java | 4 ++-- .../RestClusterUpdateSettingsAction.java | 2 +- .../cluster/RestCreateSnapshotAction.java | 4 ++-- .../cluster/RestDeleteRepositoryAction.java | 2 +- .../cluster/RestDeleteSnapshotAction.java | 2 +- .../cluster/RestDeleteStoredScriptAction.java | 2 +- .../cluster/RestGetRepositoriesAction.java | 4 ++-- .../cluster/RestGetScriptContextAction.java | 2 +- .../cluster/RestGetScriptLanguageAction.java | 2 +- .../admin/cluster/RestGetSnapshotsAction.java | 2 +- .../cluster/RestGetStoredScriptAction.java | 2 +- .../admin/cluster/RestGetTaskAction.java | 2 +- .../admin/cluster/RestListTasksAction.java | 2 +- .../cluster/RestNodesHotThreadsAction.java | 16 +++++++------- .../admin/cluster/RestNodesInfoAction.java | 8 +++---- .../admin/cluster/RestNodesStatsAction.java | 12 +++++----- .../admin/cluster/RestNodesUsageAction.java | 8 +++---- .../RestPendingClusterTasksAction.java | 2 +- .../cluster/RestPutRepositoryAction.java | 4 ++-- .../cluster/RestPutStoredScriptAction.java | 8 +++---- .../RestReloadSecureSettingsAction.java | 4 ++-- .../cluster/RestRemoteClusterInfoAction.java | 2 +- .../cluster/RestRestoreSnapshotAction.java | 2 +- .../cluster/RestSnapshotsStatusAction.java | 6 ++--- .../cluster/RestVerifyRepositoryAction.java | 2 +- .../admin/indices/RestAnalyzeAction.java | 8 +++---- .../indices/RestClearIndicesCacheAction.java | 4 ++-- .../admin/indices/RestCloseIndexAction.java | 4 ++-- .../admin/indices/RestCreateIndexAction.java | 2 +- .../admin/indices/RestDeleteIndexAction.java | 4 ++-- .../RestDeleteIndexTemplateAction.java | 2 +- .../action/admin/indices/RestFlushAction.java | 8 +++---- .../admin/indices/RestForceMergeAction.java | 4 ++-- .../admin/indices/RestGetAliasesAction.java | 16 +++++++------- .../indices/RestGetFieldMappingAction.java | 4 ++-- .../indices/RestGetIndexTemplateAction.java | 6 ++--- .../admin/indices/RestGetIndicesAction.java | 4 ++-- .../admin/indices/RestGetMappingAction.java | 8 +++---- .../admin/indices/RestGetSettingsAction.java | 10 ++++----- .../indices/RestIndexDeleteAliasesAction.java | 4 ++-- .../indices/RestIndexPutAliasAction.java | 22 +++++++++---------- .../indices/RestIndicesAliasesAction.java | 2 +- .../indices/RestIndicesSegmentsAction.java | 4 ++-- .../indices/RestIndicesShardStoresAction.java | 4 ++-- .../admin/indices/RestIndicesStatsAction.java | 8 +++---- .../admin/indices/RestOpenIndexAction.java | 4 ++-- .../indices/RestPutIndexTemplateAction.java | 4 ++-- .../admin/indices/RestPutMappingAction.java | 8 +++---- .../admin/indices/RestRecoveryAction.java | 4 ++-- .../admin/indices/RestRefreshAction.java | 8 +++---- .../admin/indices/RestResizeHandler.java | 12 +++++----- .../indices/RestRolloverIndexAction.java | 4 ++-- .../admin/indices/RestSyncedFlushAction.java | 8 +++---- .../indices/RestUpdateSettingsAction.java | 4 ++-- .../indices/RestUpgradeActionDeprecated.java | 4 ++-- .../RestUpgradeStatusActionDeprecated.java | 4 ++-- .../indices/RestValidateQueryAction.java | 8 +++---- .../rest/action/cat/RestAliasAction.java | 4 ++-- .../rest/action/cat/RestAllocationAction.java | 4 ++-- .../rest/action/cat/RestCatAction.java | 2 +- .../action/cat/RestCatRecoveryAction.java | 4 ++-- .../rest/action/cat/RestCountAction.java | 4 ++-- .../rest/action/cat/RestFielddataAction.java | 4 ++-- .../rest/action/cat/RestHealthAction.java | 2 +- .../rest/action/cat/RestIndicesAction.java | 4 ++-- .../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 | 4 ++-- .../rest/action/cat/RestShardsAction.java | 4 ++-- .../rest/action/cat/RestSnapshotAction.java | 4 ++-- .../rest/action/cat/RestTasksAction.java | 2 +- .../rest/action/cat/RestTemplatesAction.java | 4 ++-- .../rest/action/cat/RestThreadPoolAction.java | 4 ++-- .../rest/action/document/RestBulkAction.java | 8 +++---- .../action/document/RestDeleteAction.java | 2 +- .../rest/action/document/RestGetAction.java | 4 ++-- .../action/document/RestGetSourceAction.java | 4 ++-- .../rest/action/document/RestIndexAction.java | 10 ++++----- .../action/document/RestMultiGetAction.java | 8 +++---- .../document/RestMultiTermVectorsAction.java | 8 +++---- .../document/RestTermVectorsAction.java | 8 +++---- .../action/document/RestUpdateAction.java | 2 +- .../ingest/RestDeletePipelineAction.java | 2 +- .../action/ingest/RestGetPipelineAction.java | 4 ++-- .../action/ingest/RestPutPipelineAction.java | 2 +- .../ingest/RestSimulatePipelineAction.java | 8 +++---- .../action/search/RestClearScrollAction.java | 4 ++-- .../rest/action/search/RestCountAction.java | 8 +++---- .../rest/action/search/RestExplainAction.java | 4 ++-- .../action/search/RestMultiSearchAction.java | 8 +++---- .../rest/action/search/RestSearchAction.java | 8 +++---- .../action/search/RestSearchScrollAction.java | 8 +++---- .../action/ActionModuleTests.java | 6 ++--- .../RestGetAutoscalingDecisionHandler.java | 2 +- .../xpack/ccr/rest/RestCcrStatsAction.java | 2 +- .../RestDeleteAutoFollowPatternAction.java | 2 +- .../xpack/ccr/rest/RestFollowInfoAction.java | 2 +- .../xpack/ccr/rest/RestFollowStatsAction.java | 2 +- .../ccr/rest/RestForgetFollowerAction.java | 2 +- .../rest/RestGetAutoFollowPatternAction.java | 4 ++-- .../RestPauseAutoFollowPatternAction.java | 2 +- .../xpack/ccr/rest/RestPauseFollowAction.java | 2 +- .../rest/RestPutAutoFollowPatternAction.java | 2 +- .../xpack/ccr/rest/RestPutFollowAction.java | 2 +- .../RestResumeAutoFollowPatternAction.java | 2 +- .../ccr/rest/RestResumeFollowAction.java | 2 +- .../xpack/ccr/rest/RestUnfollowAction.java | 2 +- .../license/RestDeleteLicenseAction.java | 2 +- .../license/RestGetBasicStatus.java | 2 +- .../license/RestGetLicenseAction.java | 2 +- .../license/RestGetTrialStatus.java | 2 +- .../license/RestPostStartBasicLicense.java | 2 +- .../license/RestPostStartTrialLicense.java | 2 +- .../license/RestPutLicenseAction.java | 4 ++-- .../action/RestReloadAnalyzersAction.java | 4 ++-- .../core/rest/action/RestXPackInfoAction.java | 4 ++-- .../rest/action/RestXPackUsageAction.java | 2 +- .../rest/RestGetCertificateInfoAction.java | 2 +- .../RestDeprecationInfoAction.java | 4 ++-- .../rest/RestDeleteEnrichPolicyAction.java | 2 +- .../enrich/rest/RestEnrichStatsAction.java | 2 +- .../rest/RestExecuteEnrichPolicyAction.java | 2 +- .../rest/RestGetEnrichPolicyAction.java | 2 +- .../rest/RestPutEnrichPolicyAction.java | 2 +- .../xpack/eql/plugin/RestEqlSearchAction.java | 4 ++-- .../rest/action/RestFreezeIndexAction.java | 4 ++-- .../graph/rest/action/RestGraphAction.java | 4 ++-- .../ilm/action/RestDeleteLifecycleAction.java | 2 +- .../action/RestExplainLifecycleAction.java | 2 +- .../ilm/action/RestGetLifecycleAction.java | 4 ++-- .../xpack/ilm/action/RestGetStatusAction.java | 2 +- .../ilm/action/RestMoveToStepAction.java | 2 +- .../ilm/action/RestPutLifecycleAction.java | 2 +- .../RestRemoveIndexLifecyclePolicyAction.java | 2 +- .../xpack/ilm/action/RestRetryAction.java | 2 +- .../xpack/ilm/action/RestStartILMAction.java | 2 +- .../xpack/ilm/action/RestStopAction.java | 2 +- .../RestDeleteSnapshotLifecycleAction.java | 2 +- .../RestExecuteSnapshotLifecycleAction.java | 4 ++-- .../RestExecuteSnapshotRetentionAction.java | 2 +- .../slm/action/RestGetSLMStatusAction.java | 2 +- .../RestGetSnapshotLifecycleAction.java | 4 ++-- .../RestGetSnapshotLifecycleStatsAction.java | 2 +- .../RestPutSnapshotLifecycleAction.java | 2 +- .../xpack/slm/action/RestStartSLMAction.java | 2 +- .../xpack/slm/action/RestStopSLMAction.java | 2 +- .../ml/rest/cat/RestCatDatafeedsAction.java | 4 ++-- .../xpack/ml/rest/cat/RestCatJobsAction.java | 4 ++-- .../rest/cat/RestCatTrainedModelsAction.java | 4 ++-- .../RestDeleteDataFrameAnalyticsAction.java | 2 +- .../RestEvaluateDataFrameAction.java | 2 +- .../RestExplainDataFrameAnalyticsAction.java | 12 +++++----- .../RestGetDataFrameAnalyticsAction.java | 4 ++-- .../RestGetDataFrameAnalyticsStatsAction.java | 6 ++--- .../RestPutDataFrameAnalyticsAction.java | 2 +- .../RestStartDataFrameAnalyticsAction.java | 4 ++-- .../RestStopDataFrameAnalyticsAction.java | 4 ++-- .../RestDeleteTrainedModelAction.java | 2 +- .../inference/RestGetTrainedModelsAction.java | 4 ++-- .../RestGetTrainedModelsStatsAction.java | 4 ++-- .../inference/RestPutTrainedModelAction.java | 2 +- .../ml/rest/job/RestDeleteForecastAction.java | 2 +- .../rest/action/RestMonitoringBulkAction.java | 4 ++-- .../rest/RestDeleteRollupJobAction.java | 2 +- .../rollup/rest/RestGetRollupCapsAction.java | 2 +- .../rest/RestGetRollupIndexCapsAction.java | 2 +- .../rollup/rest/RestGetRollupJobsAction.java | 2 +- .../rollup/rest/RestPutRollupJobAction.java | 2 +- .../rollup/rest/RestRollupSearchAction.java | 8 +++---- .../rollup/rest/RestStartRollupJobAction.java | 2 +- .../rollup/rest/RestStopRollupJobAction.java | 2 +- .../RestDelegatePkiAuthenticationAction.java | 2 +- .../action/apikey/RestCreateApiKeyAction.java | 4 ++-- .../action/apikey/RestGetApiKeyAction.java | 2 +- .../apikey/RestInvalidateApiKeyAction.java | 2 +- .../RestOpenIdConnectAuthenticateAction.java | 2 +- .../oidc/RestOpenIdConnectLogoutAction.java | 2 +- ...nIdConnectPrepareAuthenticationAction.java | 2 +- .../RestGetBuiltinPrivilegesAction.java | 2 +- .../sql/plugin/RestSqlClearCursorAction.java | 2 +- .../xpack/sql/plugin/RestSqlQueryAction.java | 4 ++-- .../xpack/sql/plugin/RestSqlStatsAction.java | 2 +- .../sql/plugin/RestSqlTranslateAction.java | 4 ++-- .../action/RestDeleteTransformAction.java | 2 +- .../rest/action/RestGetTransformAction.java | 4 ++-- .../action/RestGetTransformStatsAction.java | 4 ++-- .../action/RestPreviewTransformAction.java | 2 +- .../rest/action/RestPutTransformAction.java | 2 +- .../rest/action/RestStartTransformAction.java | 2 +- .../rest/action/RestStopTransformAction.java | 2 +- .../action/RestUpdateTransformAction.java | 2 +- .../RestDeleteTransformActionDeprecated.java | 4 ++-- .../RestGetTransformActionDeprecated.java | 8 +++---- ...RestGetTransformStatsActionDeprecated.java | 8 +++---- .../RestPreviewTransformActionDeprecated.java | 4 ++-- .../RestPutTransformActionDeprecated.java | 4 ++-- .../RestStartTransformActionDeprecated.java | 4 ++-- .../RestStopTransformActionDeprecated.java | 4 ++-- .../RestUpdateTransformActionDeprecated.java | 4 ++-- .../rest/action/RestAckWatchAction.java | 8 +++---- .../rest/action/RestActivateWatchAction.java | 8 +++---- .../rest/action/RestDeleteWatchAction.java | 2 +- .../rest/action/RestExecuteWatchAction.java | 8 +++---- .../rest/action/RestGetWatchAction.java | 2 +- .../rest/action/RestPutWatchAction.java | 4 ++-- .../rest/action/RestWatchServiceAction.java | 4 ++-- .../rest/action/RestWatcherStatsAction.java | 4 ++-- 241 files changed, 482 insertions(+), 482 deletions(-) diff --git a/client/client-benchmark-noop-api-plugin/src/main/java/org/elasticsearch/plugin/noop/action/bulk/RestNoopBulkAction.java b/client/client-benchmark-noop-api-plugin/src/main/java/org/elasticsearch/plugin/noop/action/bulk/RestNoopBulkAction.java index 6333c7391f60e..af94cb97c70c8 100644 --- a/client/client-benchmark-noop-api-plugin/src/main/java/org/elasticsearch/plugin/noop/action/bulk/RestNoopBulkAction.java +++ b/client/client-benchmark-noop-api-plugin/src/main/java/org/elasticsearch/plugin/noop/action/bulk/RestNoopBulkAction.java @@ -50,10 +50,10 @@ public class RestNoopBulkAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_noop_bulk", POST), - new Route("/_noop_bulk", PUT), - new Route("/{index}/_noop_bulk", POST), - new Route("/{index}/_noop_bulk", PUT))); + new Route(POST, "/_noop_bulk"), + new Route(PUT, "/_noop_bulk"), + new Route(POST, "/{index}/_noop_bulk"), + new Route(PUT, "/{index}/_noop_bulk"))); } @Override diff --git a/client/client-benchmark-noop-api-plugin/src/main/java/org/elasticsearch/plugin/noop/action/search/RestNoopSearchAction.java b/client/client-benchmark-noop-api-plugin/src/main/java/org/elasticsearch/plugin/noop/action/search/RestNoopSearchAction.java index 15cb525d49a66..a9b0fe2d84cb4 100644 --- a/client/client-benchmark-noop-api-plugin/src/main/java/org/elasticsearch/plugin/noop/action/search/RestNoopSearchAction.java +++ b/client/client-benchmark-noop-api-plugin/src/main/java/org/elasticsearch/plugin/noop/action/search/RestNoopSearchAction.java @@ -36,10 +36,10 @@ public class RestNoopSearchAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_noop_search", GET), - new Route("/_noop_search", POST), - new Route("/{index}/_noop_search", GET), - new Route("/{index}/_noop_search", POST))); + new Route(GET, "/_noop_search"), + new Route(POST, "/_noop_search"), + new Route(GET, "/{index}/_noop_search"), + new Route(POST, "/{index}/_noop_search"))); } @Override diff --git a/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/GrokProcessorGetAction.java b/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/GrokProcessorGetAction.java index 1e212b007bbb5..ee277addd20ec 100644 --- a/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/GrokProcessorGetAction.java +++ b/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/GrokProcessorGetAction.java @@ -120,7 +120,7 @@ public static class RestAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_ingest/processor/grok", GET)); + return singletonList(new Route(GET, "/_ingest/processor/grok")); } @Override diff --git a/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestMultiSearchTemplateAction.java b/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestMultiSearchTemplateAction.java index 6669132395b86..72403afc423e2 100644 --- a/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestMultiSearchTemplateAction.java +++ b/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestMultiSearchTemplateAction.java @@ -59,10 +59,10 @@ public RestMultiSearchTemplateAction(Settings settings) { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_msearch/template", GET), - new Route("/_msearch/template", POST), - new Route("/{index}/_msearch/template", GET), - new Route("/{index}/_msearch/template", POST))); + new Route(GET, "/_msearch/template"), + new Route(POST, "/_msearch/template"), + new Route(GET, "/{index}/_msearch/template"), + new Route(POST, "/{index}/_msearch/template"))); } @Override diff --git a/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestRenderSearchTemplateAction.java b/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestRenderSearchTemplateAction.java index 2a78684daede6..d6635c060993a 100644 --- a/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestRenderSearchTemplateAction.java +++ b/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestRenderSearchTemplateAction.java @@ -39,10 +39,10 @@ public class RestRenderSearchTemplateAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_render/template", GET), - new Route("/_render/template", POST), - new Route("/_render/template/{id}", GET), - new Route("/_render/template/{id}", POST))); + new Route(GET, "/_render/template"), + new Route(POST, "/_render/template"), + new Route(GET, "/_render/template/{id}"), + new Route(POST, "/_render/template/{id}"))); } @Override diff --git a/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestSearchTemplateAction.java b/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestSearchTemplateAction.java index ea8f54a2b7ca4..7baf7c8cca4c2 100644 --- a/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestSearchTemplateAction.java +++ b/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestSearchTemplateAction.java @@ -51,10 +51,10 @@ public class RestSearchTemplateAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_search/template", GET), - new Route("/_search/template", POST), - new Route("/{index}/_search/template", GET), - new Route("/{index}/_search/template", POST))); + new Route(GET, "/_search/template"), + new Route(POST, "/_search/template"), + new Route(GET, "/{index}/_search/template"), + new Route(POST, "/{index}/_search/template"))); } @Override diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/action/PainlessContextAction.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/action/PainlessContextAction.java index 7e77f484fe102..2963d68a7cf98 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/action/PainlessContextAction.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/action/PainlessContextAction.java @@ -196,7 +196,7 @@ public static class RestAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_scripts/painless/_context", GET)); + return singletonList(new Route(GET, "/_scripts/painless/_context")); } @Override diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/action/PainlessExecuteAction.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/action/PainlessExecuteAction.java index bf6cbee1cd7bb..048067e90580b 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/action/PainlessExecuteAction.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/action/PainlessExecuteAction.java @@ -569,8 +569,8 @@ public static class RestAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_scripts/painless/_execute", GET), - new Route("/_scripts/painless/_execute", POST))); + new Route(GET, "/_scripts/painless/_execute"), + new Route(POST, "/_scripts/painless/_execute"))); } @Override diff --git a/modules/rank-eval/src/main/java/org/elasticsearch/index/rankeval/RestRankEvalAction.java b/modules/rank-eval/src/main/java/org/elasticsearch/index/rankeval/RestRankEvalAction.java index 452425303a25e..6874935c97a8e 100644 --- a/modules/rank-eval/src/main/java/org/elasticsearch/index/rankeval/RestRankEvalAction.java +++ b/modules/rank-eval/src/main/java/org/elasticsearch/index/rankeval/RestRankEvalAction.java @@ -95,10 +95,10 @@ public class RestRankEvalAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/" + ENDPOINT, GET), - new Route("/" + ENDPOINT, POST), - new Route("/{index}/" + ENDPOINT, GET), - new Route("/{index}/" + ENDPOINT, POST))); + new Route(GET, "/" + ENDPOINT), + new Route(POST, "/" + ENDPOINT), + new Route(GET, "/{index}/" + ENDPOINT), + new Route(POST, "/{index}/" + ENDPOINT))); } @Override diff --git a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestDeleteByQueryAction.java b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestDeleteByQueryAction.java index 162fcc4ae72f5..0f4983d570e6a 100644 --- a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestDeleteByQueryAction.java +++ b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestDeleteByQueryAction.java @@ -39,7 +39,7 @@ public RestDeleteByQueryAction() { @Override public List handledRoutes() { - return singletonList(new Route("/{index}/_delete_by_query", POST)); + return singletonList(new Route(POST, "/{index}/_delete_by_query")); } @Override diff --git a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestReindexAction.java b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestReindexAction.java index e84034ee25d19..bb5d2e5def5b1 100644 --- a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestReindexAction.java +++ b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestReindexAction.java @@ -41,7 +41,7 @@ public RestReindexAction() { @Override public List handledRoutes() { - return singletonList(new Route("/_reindex", POST)); + return singletonList(new Route(POST, "/_reindex")); } @Override diff --git a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestRethrottleAction.java b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestRethrottleAction.java index 40d9d1edadcad..dedb57db26961 100644 --- a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestRethrottleAction.java +++ b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestRethrottleAction.java @@ -43,9 +43,9 @@ public RestRethrottleAction(Supplier nodesInCluster) { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_update_by_query/{taskId}/_rethrottle", POST), - new Route("/_delete_by_query/{taskId}/_rethrottle", POST), - new Route("/_reindex/{taskId}/_rethrottle", POST))); + new Route(POST, "/_update_by_query/{taskId}/_rethrottle"), + new Route(POST, "/_delete_by_query/{taskId}/_rethrottle"), + new Route(POST, "/_reindex/{taskId}/_rethrottle"))); } @Override diff --git a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestUpdateByQueryAction.java b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestUpdateByQueryAction.java index 42423cbfb8b46..f6bcfac9b10ea 100644 --- a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestUpdateByQueryAction.java +++ b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestUpdateByQueryAction.java @@ -46,7 +46,7 @@ public RestUpdateByQueryAction() { @Override public List handledRoutes() { - return singletonList(new Route("/{index}/_update_by_query", POST)); + return singletonList(new Route(POST, "/{index}/_update_by_query")); } @Override diff --git a/plugins/examples/rest-handler/src/main/java/org/elasticsearch/example/resthandler/ExampleCatAction.java b/plugins/examples/rest-handler/src/main/java/org/elasticsearch/example/resthandler/ExampleCatAction.java index b29abf73f8a3c..7110cac467a8f 100644 --- a/plugins/examples/rest-handler/src/main/java/org/elasticsearch/example/resthandler/ExampleCatAction.java +++ b/plugins/examples/rest-handler/src/main/java/org/elasticsearch/example/resthandler/ExampleCatAction.java @@ -40,8 +40,8 @@ public class ExampleCatAction extends AbstractCatAction { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_cat/example", GET), - new Route("/_cat/example", POST))); + new Route(GET, "/_cat/example"), + new Route(POST, "/_cat/example"))); } @Override diff --git a/qa/die-with-dignity/src/main/java/org/elasticsearch/RestDieWithDignityAction.java b/qa/die-with-dignity/src/main/java/org/elasticsearch/RestDieWithDignityAction.java index df370ccb55fc7..a15251b58f512 100644 --- a/qa/die-with-dignity/src/main/java/org/elasticsearch/RestDieWithDignityAction.java +++ b/qa/die-with-dignity/src/main/java/org/elasticsearch/RestDieWithDignityAction.java @@ -34,7 +34,7 @@ public class RestDieWithDignityAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_die_with_dignity", GET)); + return singletonList(new Route(GET, "/_die_with_dignity")); } @Override diff --git a/qa/smoke-test-http/src/test/java/org/elasticsearch/http/TestDeprecationHeaderRestAction.java b/qa/smoke-test-http/src/test/java/org/elasticsearch/http/TestDeprecationHeaderRestAction.java index c0010f00ec354..08f7d68e91f41 100644 --- a/qa/smoke-test-http/src/test/java/org/elasticsearch/http/TestDeprecationHeaderRestAction.java +++ b/qa/smoke-test-http/src/test/java/org/elasticsearch/http/TestDeprecationHeaderRestAction.java @@ -76,7 +76,7 @@ public TestDeprecationHeaderRestAction(Settings settings) { @Override public List deprecatedRoutes() { return singletonList( - new DeprecatedRoute("/_test_cluster/deprecated_settings", GET, DEPRECATED_ENDPOINT, deprecationLogger)); + new DeprecatedRoute(GET, "/_test_cluster/deprecated_settings", DEPRECATED_ENDPOINT, deprecationLogger)); } @Override diff --git a/qa/smoke-test-http/src/test/java/org/elasticsearch/http/TestResponseHeaderRestAction.java b/qa/smoke-test-http/src/test/java/org/elasticsearch/http/TestResponseHeaderRestAction.java index 752316b6b23c5..62f57178ef177 100644 --- a/qa/smoke-test-http/src/test/java/org/elasticsearch/http/TestResponseHeaderRestAction.java +++ b/qa/smoke-test-http/src/test/java/org/elasticsearch/http/TestResponseHeaderRestAction.java @@ -34,7 +34,7 @@ public class TestResponseHeaderRestAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_protected", GET)); + return singletonList(new Route(GET, "/_protected")); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/RestHandler.java b/server/src/main/java/org/elasticsearch/rest/RestHandler.java index cc0edc3097fb0..bd37cd4aa4d94 100644 --- a/server/src/main/java/org/elasticsearch/rest/RestHandler.java +++ b/server/src/main/java/org/elasticsearch/rest/RestHandler.java @@ -95,7 +95,7 @@ class Route { private final String path; private final Method method; - public Route(String path, Method method) { + public Route(Method method, String path) { this.path = path; this.method = method; } @@ -117,8 +117,8 @@ class DeprecatedRoute extends Route { private final String deprecationMessage; private final DeprecationLogger logger; - public DeprecatedRoute(String path, Method method, String deprecationMessage, DeprecationLogger logger) { - super(path, method); + public DeprecatedRoute(Method method, String path, String deprecationMessage, DeprecationLogger logger) { + super(method, path); this.deprecationMessage = deprecationMessage; this.logger = logger; } @@ -143,7 +143,7 @@ class ReplacedRoute extends Route { private final DeprecationLogger logger; public ReplacedRoute(Method method, String path, Method deprecatedMethod, String deprecatedPath, DeprecationLogger logger) { - super(path, method); + super(method, path); this.deprecatedMethod = deprecatedMethod; this.deprecatedPath = deprecatedPath; this.logger = logger; diff --git a/server/src/main/java/org/elasticsearch/rest/action/RestFieldCapabilitiesAction.java b/server/src/main/java/org/elasticsearch/rest/action/RestFieldCapabilitiesAction.java index eb83a7c6de7a5..3355435d567a7 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/RestFieldCapabilitiesAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/RestFieldCapabilitiesAction.java @@ -39,10 +39,10 @@ public class RestFieldCapabilitiesAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_field_caps", GET), - new Route("/_field_caps", POST), - new Route("/{index}/_field_caps", GET), - new Route("/{index}/_field_caps", POST))); + new Route(GET, "/_field_caps"), + new Route(POST, "/_field_caps"), + new Route(GET, "/{index}/_field_caps"), + new Route(POST, "/{index}/_field_caps"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/RestMainAction.java b/server/src/main/java/org/elasticsearch/rest/action/RestMainAction.java index da86dfef1982f..025a03b16486f 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/RestMainAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/RestMainAction.java @@ -43,8 +43,8 @@ public class RestMainAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/", GET), - new Route("/", HEAD))); + new Route(GET, "/"), + new Route(HEAD, "/"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestAddVotingConfigExclusionAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestAddVotingConfigExclusionAction.java index bea4dbfb1f21a..2d257cca71c03 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestAddVotingConfigExclusionAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestAddVotingConfigExclusionAction.java @@ -45,7 +45,7 @@ public String getName() { @Override public List handledRoutes() { - return singletonList(new Route("/_cluster/voting_config_exclusions/{node_name}", POST)); + return singletonList(new Route(POST, "/_cluster/voting_config_exclusions/{node_name}")); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCancelTasksAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCancelTasksAction.java index 75b2cb5f8d8f1..820806bc5b47b 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCancelTasksAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCancelTasksAction.java @@ -51,8 +51,8 @@ public String getName() { @Override public List handledRoutes() { - return unmodifiableList(asList(new Route("/_tasks/_cancel", POST), - new Route("/_tasks/{task_id}/_cancel", POST))); + return unmodifiableList(asList(new Route(POST, "/_tasks/_cancel"), + new Route(POST, "/_tasks/{task_id}/_cancel"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCleanupRepositoryAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCleanupRepositoryAction.java index aa4421ea75d72..7ac61a69820da 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCleanupRepositoryAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCleanupRepositoryAction.java @@ -39,7 +39,7 @@ public class RestCleanupRepositoryAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_snapshot/{repository}/_cleanup", POST)); + return singletonList(new Route(POST, "/_snapshot/{repository}/_cleanup")); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClearVotingConfigExclusionsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClearVotingConfigExclusionsAction.java index d07c94a4a7563..7012284287266 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClearVotingConfigExclusionsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClearVotingConfigExclusionsAction.java @@ -36,7 +36,7 @@ public class RestClearVotingConfigExclusionsAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_cluster/voting_config_exclusions", DELETE)); + return singletonList(new Route(DELETE, "/_cluster/voting_config_exclusions")); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterAllocationExplainAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterAllocationExplainAction.java index 7a58e4cda682b..8391d8279cb5c 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterAllocationExplainAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterAllocationExplainAction.java @@ -48,8 +48,8 @@ public class RestClusterAllocationExplainAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_cluster/allocation/explain", GET), - new Route("/_cluster/allocation/explain", POST))); + new Route(GET, "/_cluster/allocation/explain"), + new Route(POST, "/_cluster/allocation/explain"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterGetSettingsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterGetSettingsAction.java index 14c348f5649de..157de85ff57a9 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterGetSettingsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterGetSettingsAction.java @@ -58,7 +58,7 @@ public RestClusterGetSettingsAction(Settings settings, ClusterSettings clusterSe @Override public List handledRoutes() { - return singletonList(new Route("/_cluster/settings", GET)); + return singletonList(new Route(GET, "/_cluster/settings")); } @Override public String getName() { diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterHealthAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterHealthAction.java index 613331f8fbd94..acb8248eb44d2 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterHealthAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterHealthAction.java @@ -45,8 +45,8 @@ public class RestClusterHealthAction extends BaseRestHandler { @Override public List handledRoutes() { - return unmodifiableList(asList(new Route("/_cluster/health", GET), - new Route("/_cluster/health/{index}", GET))); + return unmodifiableList(asList(new Route(GET, "/_cluster/health"), + new Route(GET, "/_cluster/health/{index}"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterRerouteAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterRerouteAction.java index e33d950a0e8bd..6a2679e1f5bf4 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterRerouteAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterRerouteAction.java @@ -63,7 +63,7 @@ public RestClusterRerouteAction(SettingsFilter settingsFilter) { @Override public List handledRoutes() { - return singletonList(new Route("/_cluster/reroute", POST)); + return singletonList(new Route(POST, "/_cluster/reroute")); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterSearchShardsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterSearchShardsAction.java index 55969bc892015..0cb32cb0b6219 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterSearchShardsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterSearchShardsAction.java @@ -41,10 +41,10 @@ public class RestClusterSearchShardsAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_search_shards", GET), - new Route("/_search_shards", POST), - new Route("/{index}/_search_shards", GET), - new Route("/{index}/_search_shards", POST))); + new Route(GET, "/_search_shards"), + new Route(POST, "/_search_shards"), + new Route(GET, "/{index}/_search_shards"), + new Route(POST, "/{index}/_search_shards"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterStateAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterStateAction.java index de95a90fd2256..b938bc1e9fc2a 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterStateAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterStateAction.java @@ -63,9 +63,9 @@ public String getName() { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_cluster/state", GET), - new Route("/_cluster/state/{metric}", GET), - new Route("/_cluster/state/{metric}/{indices}", GET))); + new Route(GET, "/_cluster/state"), + new Route(GET, "/_cluster/state/{metric}"), + new Route(GET, "/_cluster/state/{metric}/{indices}"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterStatsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterStatsAction.java index 41aca857cfee8..e3bee7ade71b9 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterStatsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterStatsAction.java @@ -37,8 +37,8 @@ public class RestClusterStatsAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_cluster/stats", GET), - new Route("/_cluster/stats/nodes/{nodeId}", GET))); + new Route(GET, "/_cluster/stats"), + new Route(GET, "/_cluster/stats/nodes/{nodeId}"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterUpdateSettingsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterUpdateSettingsAction.java index 614b22a201217..0556e68cd2cef 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterUpdateSettingsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterUpdateSettingsAction.java @@ -43,7 +43,7 @@ public class RestClusterUpdateSettingsAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_cluster/settings", PUT)); + return singletonList(new Route(PUT, "/_cluster/settings")); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCreateSnapshotAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCreateSnapshotAction.java index 840f9ea6a28dd..db7cae7b063e8 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCreateSnapshotAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCreateSnapshotAction.java @@ -42,8 +42,8 @@ public class RestCreateSnapshotAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_snapshot/{repository}/{snapshot}", PUT), - new Route("/_snapshot/{repository}/{snapshot}", POST))); + new Route(PUT, "/_snapshot/{repository}/{snapshot}"), + new Route(POST, "/_snapshot/{repository}/{snapshot}"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteRepositoryAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteRepositoryAction.java index ee79820d22129..5436bf1035872 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteRepositoryAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteRepositoryAction.java @@ -39,7 +39,7 @@ public class RestDeleteRepositoryAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_snapshot/{repository}", DELETE)); + return singletonList(new Route(DELETE, "/_snapshot/{repository}")); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteSnapshotAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteSnapshotAction.java index 8249d64f20bd5..68951288d575f 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteSnapshotAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteSnapshotAction.java @@ -39,7 +39,7 @@ public class RestDeleteSnapshotAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_snapshot/{repository}/{snapshot}", DELETE)); + return singletonList(new Route(DELETE, "/_snapshot/{repository}/{snapshot}")); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteStoredScriptAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteStoredScriptAction.java index 8a93865857a19..51da84f865a39 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteStoredScriptAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteStoredScriptAction.java @@ -34,7 +34,7 @@ public class RestDeleteStoredScriptAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_scripts/{id}", DELETE)); + return singletonList(new Route(DELETE, "/_scripts/{id}")); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetRepositoriesAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetRepositoriesAction.java index 82276f67c6aa3..1503a0bd60bcc 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetRepositoriesAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetRepositoriesAction.java @@ -56,8 +56,8 @@ public String getName() { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_snapshot", GET), - new Route("/_snapshot/{repository}", GET))); + new Route(GET, "/_snapshot"), + new Route(GET, "/_snapshot/{repository}"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetScriptContextAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetScriptContextAction.java index c0f1f0d30bf2e..c8c048496d835 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetScriptContextAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetScriptContextAction.java @@ -36,7 +36,7 @@ public class RestGetScriptContextAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_script_context", GET)); + return singletonList(new Route(GET, "/_script_context")); } @Override public String getName() { diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetScriptLanguageAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetScriptLanguageAction.java index 707ebe463829c..9e54adf566403 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetScriptLanguageAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetScriptLanguageAction.java @@ -36,7 +36,7 @@ public class RestGetScriptLanguageAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_script_language", GET)); + return singletonList(new Route(GET, "/_script_language")); } @Override public String getName() { diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetSnapshotsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetSnapshotsAction.java index 3bd8faa2cf8b5..97c39b7f22132 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetSnapshotsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetSnapshotsAction.java @@ -40,7 +40,7 @@ public class RestGetSnapshotsAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_snapshot/{repository}/{snapshot}", GET)); + return singletonList(new Route(GET, "/_snapshot/{repository}/{snapshot}")); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetStoredScriptAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetStoredScriptAction.java index 09059c218c760..4862dcab0a07e 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetStoredScriptAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetStoredScriptAction.java @@ -34,7 +34,7 @@ public class RestGetStoredScriptAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_scripts/{id}", GET)); + return singletonList(new Route(GET, "/_scripts/{id}")); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetTaskAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetTaskAction.java index 357f8342ab94c..d540897d7f413 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetTaskAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetTaskAction.java @@ -37,7 +37,7 @@ public class RestGetTaskAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_tasks/{task_id}", GET)); + return singletonList(new Route(GET, "/_tasks/{task_id}")); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestListTasksAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestListTasksAction.java index 2ab497a956a8e..ba425eb0cfd30 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestListTasksAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestListTasksAction.java @@ -55,7 +55,7 @@ public RestListTasksAction(Supplier nodesInCluster) { @Override public List handledRoutes() { - return singletonList(new Route("/_tasks", GET)); + return singletonList(new Route(GET, "/_tasks")); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesHotThreadsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesHotThreadsAction.java index ce4428d2da49c..aac11df51e565 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesHotThreadsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesHotThreadsAction.java @@ -45,14 +45,14 @@ public class RestNodesHotThreadsAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_cluster/nodes/hotthreads", GET), - new Route("/_cluster/nodes/hot_threads", GET), - new Route("/_cluster/nodes/{nodeId}/hotthreads", GET), - new Route("/_cluster/nodes/{nodeId}/hot_threads", GET), - new Route("/_nodes/hotthreads", GET), - new Route("/_nodes/hot_threads", GET), - new Route("/_nodes/{nodeId}/hotthreads", GET), - new Route("/_nodes/{nodeId}/hot_threads", GET))); + new Route(GET, "/_cluster/nodes/hotthreads"), + new Route(GET, "/_cluster/nodes/hot_threads"), + new Route(GET, "/_cluster/nodes/{nodeId}/hotthreads"), + new Route(GET, "/_cluster/nodes/{nodeId}/hot_threads"), + new Route(GET, "/_nodes/hotthreads"), + new Route(GET, "/_nodes/hot_threads"), + new Route(GET, "/_nodes/{nodeId}/hotthreads"), + new Route(GET, "/_nodes/{nodeId}/hot_threads"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesInfoAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesInfoAction.java index ab1fa61e50f2a..87fd7ddb2cd95 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesInfoAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesInfoAction.java @@ -59,12 +59,12 @@ public RestNodesInfoAction(SettingsFilter settingsFilter) { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_nodes", GET), + new Route(GET, "/_nodes"), // this endpoint is used for metrics, not for node IDs, like /_nodes/fs - new Route("/_nodes/{nodeId}", GET), - new Route("/_nodes/{nodeId}/{metrics}", GET), + new Route(GET, "/_nodes/{nodeId}"), + new Route(GET, "/_nodes/{nodeId}/{metrics}"), // added this endpoint to be aligned with stats - new Route("/_nodes/{nodeId}/info/{metrics}", GET))); + new Route(GET, "/_nodes/{nodeId}/info/{metrics}"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsAction.java index 247530811ee32..032a288b61227 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsAction.java @@ -48,12 +48,12 @@ public class RestNodesStatsAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_nodes/stats", GET), - new Route("/_nodes/{nodeId}/stats", GET), - new Route("/_nodes/stats/{metric}", GET), - new Route("/_nodes/{nodeId}/stats/{metric}", GET), - new Route("/_nodes/stats/{metric}/{index_metric}", GET), - new Route("/_nodes/{nodeId}/stats/{metric}/{index_metric}", GET))); + new Route(GET, "/_nodes/stats"), + new Route(GET, "/_nodes/{nodeId}/stats"), + new Route(GET, "/_nodes/stats/{metric}"), + new Route(GET, "/_nodes/{nodeId}/stats/{metric}"), + new Route(GET, "/_nodes/stats/{metric}/{index_metric}"), + new Route(GET, "/_nodes/{nodeId}/stats/{metric}/{index_metric}"))); } static final Map> METRICS = Map.ofEntries( diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesUsageAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesUsageAction.java index 28a5dbc41a642..c5aa7fcf0bebe 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesUsageAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesUsageAction.java @@ -46,10 +46,10 @@ public class RestNodesUsageAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_nodes/usage", GET), - new Route("/_nodes/{nodeId}/usage", GET), - new Route("/_nodes/usage/{metric}", GET), - new Route("/_nodes/{nodeId}/usage/{metric}", GET))); + new Route(GET, "/_nodes/usage"), + new Route(GET, "/_nodes/{nodeId}/usage"), + new Route(GET, "/_nodes/usage/{metric}"), + new Route(GET, "/_nodes/{nodeId}/usage/{metric}"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPendingClusterTasksAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPendingClusterTasksAction.java index f4a5de4aec7b4..c6cb9b3791b8a 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPendingClusterTasksAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPendingClusterTasksAction.java @@ -35,7 +35,7 @@ public class RestPendingClusterTasksAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_cluster/pending_tasks", GET)); + return singletonList(new Route(GET, "/_cluster/pending_tasks")); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPutRepositoryAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPutRepositoryAction.java index 4dec6ae142314..6545382b02ca3 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPutRepositoryAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPutRepositoryAction.java @@ -43,8 +43,8 @@ public class RestPutRepositoryAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_snapshot/{repository}", POST), - new Route("/_snapshot/{repository}", PUT))); + new Route(POST, "/_snapshot/{repository}"), + new Route(PUT, "/_snapshot/{repository}"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPutStoredScriptAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPutStoredScriptAction.java index 9100125c72754..f6da6ebbf34ed 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPutStoredScriptAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPutStoredScriptAction.java @@ -40,10 +40,10 @@ public class RestPutStoredScriptAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_scripts/{id}", POST), - new Route("/_scripts/{id}", PUT), - new Route("/_scripts/{id}/{context}", POST), - new Route("/_scripts/{id}/{context}", PUT))); + new Route(POST, "/_scripts/{id}"), + new Route(PUT, "/_scripts/{id}"), + new Route(POST, "/_scripts/{id}/{context}"), + new Route(PUT, "/_scripts/{id}/{context}"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestReloadSecureSettingsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestReloadSecureSettingsAction.java index a15e62f703816..45b6271b621ce 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestReloadSecureSettingsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestReloadSecureSettingsAction.java @@ -61,8 +61,8 @@ public String getName() { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_nodes/reload_secure_settings", POST), - new Route("/_nodes/{nodeId}/reload_secure_settings", POST))); + new Route(POST, "/_nodes/reload_secure_settings"), + new Route(POST, "/_nodes/{nodeId}/reload_secure_settings"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestRemoteClusterInfoAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestRemoteClusterInfoAction.java index 1d0d46ce525fd..15d69560df0f1 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestRemoteClusterInfoAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestRemoteClusterInfoAction.java @@ -35,7 +35,7 @@ public final class RestRemoteClusterInfoAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("_remote/info", GET)); + return singletonList(new Route(GET, "_remote/info")); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestRestoreSnapshotAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestRestoreSnapshotAction.java index 4276880a8a48e..985ffbe575590 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestRestoreSnapshotAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestRestoreSnapshotAction.java @@ -39,7 +39,7 @@ public class RestRestoreSnapshotAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_snapshot/{repository}/{snapshot}/_restore", POST)); + return singletonList(new Route(POST, "/_snapshot/{repository}/{snapshot}/_restore")); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestSnapshotsStatusAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestSnapshotsStatusAction.java index de29792d589b6..dacdd07ac833d 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestSnapshotsStatusAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestSnapshotsStatusAction.java @@ -42,9 +42,9 @@ public class RestSnapshotsStatusAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_snapshot/{repository}/{snapshot}/_status", GET), - new Route("/_snapshot/{repository}/_status", GET), - new Route("/_snapshot/_status", GET))); + new Route(GET, "/_snapshot/{repository}/{snapshot}/_status"), + new Route(GET, "/_snapshot/{repository}/_status"), + new Route(GET, "/_snapshot/_status"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestVerifyRepositoryAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestVerifyRepositoryAction.java index c2c557d58d03a..7a38348c72db4 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestVerifyRepositoryAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestVerifyRepositoryAction.java @@ -36,7 +36,7 @@ public class RestVerifyRepositoryAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_snapshot/{repository}/_verify", POST)); + return singletonList(new Route(POST, "/_snapshot/{repository}/_verify")); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestAnalyzeAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestAnalyzeAction.java index 357aa0ee42c0e..ecae40d4e7842 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestAnalyzeAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestAnalyzeAction.java @@ -51,10 +51,10 @@ public static class Fields { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_analyze", GET), - new Route("/_analyze", POST), - new Route("/{index}/_analyze", GET), - new Route("/{index}/_analyze", POST))); + new Route(GET, "/_analyze"), + new Route(POST, "/_analyze"), + new Route(GET, "/{index}/_analyze"), + new Route(POST, "/{index}/_analyze"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestClearIndicesCacheAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestClearIndicesCacheAction.java index c48e4bc882034..97d0c13b39b8d 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestClearIndicesCacheAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestClearIndicesCacheAction.java @@ -39,8 +39,8 @@ public class RestClearIndicesCacheAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_cache/clear", POST), - new Route("/{index}/_cache/clear", POST))); + new Route(POST, "/_cache/clear"), + new Route(POST, "/{index}/_cache/clear"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCloseIndexAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCloseIndexAction.java index 11cf94358c8ee..e18c94cce7e43 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCloseIndexAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCloseIndexAction.java @@ -40,8 +40,8 @@ public class RestCloseIndexAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_close", POST), - new Route("/{index}/_close", POST))); + new Route(POST, "/_close"), + new Route(POST, "/{index}/_close"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCreateIndexAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCreateIndexAction.java index dea25679dee02..c677d985f7c40 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCreateIndexAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCreateIndexAction.java @@ -42,7 +42,7 @@ public class RestCreateIndexAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/{index}", PUT)); + return singletonList(new Route(PUT, "/{index}")); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestDeleteIndexAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestDeleteIndexAction.java index ace876907af61..966f22190871c 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestDeleteIndexAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestDeleteIndexAction.java @@ -39,8 +39,8 @@ public class RestDeleteIndexAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/", DELETE), - new Route("/{index}", DELETE))); + new Route(DELETE, "/"), + new Route(DELETE, "/{index}"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestDeleteIndexTemplateAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestDeleteIndexTemplateAction.java index 44b231ce84f19..c1d08d6de6381 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestDeleteIndexTemplateAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestDeleteIndexTemplateAction.java @@ -34,7 +34,7 @@ public class RestDeleteIndexTemplateAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_template/{name}", DELETE)); + return singletonList(new Route(DELETE, "/_template/{name}")); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestFlushAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestFlushAction.java index 99222bbd1cb3c..84677e60a0147 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestFlushAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestFlushAction.java @@ -40,10 +40,10 @@ public class RestFlushAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_flush", GET), - new Route("/_flush", POST), - new Route("/{index}/_flush", GET), - new Route("/{index}/_flush", POST))); + new Route(GET, "/_flush"), + new Route(POST, "/_flush"), + new Route(GET, "/{index}/_flush"), + new Route(POST, "/{index}/_flush"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestForceMergeAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestForceMergeAction.java index 10996ef7e9110..797d2d6f27da5 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestForceMergeAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestForceMergeAction.java @@ -39,8 +39,8 @@ public class RestForceMergeAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_forcemerge", POST), - new Route("/{index}/_forcemerge", POST))); + new Route(POST, "/_forcemerge"), + new Route(POST, "/{index}/_forcemerge"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetAliasesAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetAliasesAction.java index 13259b23bcc32..d9368aaf086fe 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetAliasesAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetAliasesAction.java @@ -59,14 +59,14 @@ public class RestGetAliasesAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_alias", GET), - new Route("/_aliases", GET), - new Route("/_alias/{name}", GET), - new Route("/_alias/{name}", HEAD), - new Route("/{index}/_alias", GET), - new Route("/{index}/_alias", HEAD), - new Route("/{index}/_alias/{name}", GET), - new Route("/{index}/_alias/{name}", HEAD))); + new Route(GET, "/_alias"), + new Route(GET, "/_aliases"), + new Route(GET, "/_alias/{name}"), + new Route(HEAD, "/_alias/{name}"), + new Route(GET, "/{index}/_alias"), + new Route(HEAD, "/{index}/_alias"), + new Route(GET, "/{index}/_alias/{name}"), + new Route(HEAD, "/{index}/_alias/{name}"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetFieldMappingAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetFieldMappingAction.java index 4762e3c022af8..8dbfc6ece48a5 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetFieldMappingAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetFieldMappingAction.java @@ -48,8 +48,8 @@ public class RestGetFieldMappingAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_mapping/field/{fields}", GET), - new Route("/{index}/_mapping/field/{fields}", GET))); + new Route(GET, "/_mapping/field/{fields}"), + new Route(GET, "/{index}/_mapping/field/{fields}"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndexTemplateAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndexTemplateAction.java index a20b9cb3e2108..addfc75b00412 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndexTemplateAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndexTemplateAction.java @@ -48,9 +48,9 @@ public class RestGetIndexTemplateAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_template", GET), - new Route("/_template/{name}", GET), - new Route("/_template/{name}", HEAD))); + new Route(GET, "/_template"), + new Route(GET, "/_template/{name}"), + new Route(HEAD, "/_template/{name}"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndicesAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndicesAction.java index 4687bdff35936..f6579cb1c729c 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndicesAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndicesAction.java @@ -46,8 +46,8 @@ public class RestGetIndicesAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/{index}", GET), - new Route("/{index}", HEAD))); + new Route(GET, "/{index}"), + new Route(HEAD, "/{index}"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetMappingAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetMappingAction.java index 33c5e1c0f5a52..cf0204e31a42f 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetMappingAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetMappingAction.java @@ -44,10 +44,10 @@ public class RestGetMappingAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_mapping", GET), - new Route("/_mappings", GET), - new Route("/{index}/_mapping", GET), - new Route("/{index}/_mappings", GET))); + new Route(GET, "/_mapping"), + new Route(GET, "/_mappings"), + new Route(GET, "/{index}/_mapping"), + new Route(GET, "/{index}/_mappings"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetSettingsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetSettingsAction.java index c16fa4400d0aa..80fcdc77a22c2 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetSettingsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetSettingsAction.java @@ -39,11 +39,11 @@ public class RestGetSettingsAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_settings", GET), - new Route("/_settings/{name}", GET), - new Route("/{index}/_settings", GET), - new Route("/{index}/_settings/{name}", GET), - new Route("/{index}/_setting/{name}", GET))); + new Route(GET, "/_settings"), + new Route(GET, "/_settings/{name}"), + new Route(GET, "/{index}/_settings"), + new Route(GET, "/{index}/_settings/{name}"), + new Route(GET, "/{index}/_setting/{name}"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndexDeleteAliasesAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndexDeleteAliasesAction.java index 2f5035b7a01e1..a5b01c96b52fc 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndexDeleteAliasesAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndexDeleteAliasesAction.java @@ -38,8 +38,8 @@ public class RestIndexDeleteAliasesAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/{index}/_alias/{name}", DELETE), - new Route("/{index}/_aliases/{name}", DELETE))); + new Route(DELETE, "/{index}/_alias/{name}"), + new Route(DELETE, "/{index}/_aliases/{name}"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndexPutAliasAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndexPutAliasAction.java index 33e801fd94c8f..bb5daf7943fbd 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndexPutAliasAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndexPutAliasAction.java @@ -41,17 +41,17 @@ public class RestIndexPutAliasAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/{index}/_alias/{name}", POST), - new Route("/{index}/_alias/{name}", PUT), - new Route("/_alias/{name}", POST), - new Route("/_alias/{name}", PUT), - new Route("/{index}/_aliases/{name}", POST), - new Route("/{index}/_aliases/{name}", PUT), - new Route("/_aliases/{name}", POST), - new Route("/_aliases/{name}", PUT), - new Route("/{index}/_alias", PUT), - new Route("/{index}/_aliases", PUT), - new Route("/_alias", PUT))); + new Route(POST, "/{index}/_alias/{name}"), + new Route(PUT, "/{index}/_alias/{name}"), + new Route(POST, "/_alias/{name}"), + new Route(PUT, "/_alias/{name}"), + new Route(POST, "/{index}/_aliases/{name}"), + new Route(PUT, "/{index}/_aliases/{name}"), + new Route(POST, "/_aliases/{name}"), + new Route(PUT, "/_aliases/{name}"), + new Route(PUT, "/{index}/_alias"), + new Route(PUT, "/{index}/_aliases"), + new Route(PUT, "/_alias"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesAliasesAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesAliasesAction.java index 076acd43cae34..133d2d7bde436 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesAliasesAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesAliasesAction.java @@ -41,7 +41,7 @@ public String getName() { @Override public List handledRoutes() { - return singletonList(new Route("/_aliases", POST)); + return singletonList(new Route(POST, "/_aliases")); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesSegmentsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesSegmentsAction.java index ceee6155f1a95..3f2bd944ae410 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesSegmentsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesSegmentsAction.java @@ -39,8 +39,8 @@ public class RestIndicesSegmentsAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_segments", GET), - new Route("/{index}/_segments", GET))); + new Route(GET, "/_segments"), + new Route(GET, "/{index}/_segments"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesShardStoresAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesShardStoresAction.java index 67794e3f5b8f5..d0565c9dcfe69 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesShardStoresAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesShardStoresAction.java @@ -48,8 +48,8 @@ public class RestIndicesShardStoresAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_shard_stores", GET), - new Route("/{index}/_shard_stores", GET))); + new Route(GET, "/_shard_stores"), + new Route(GET, "/{index}/_shard_stores"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsAction.java index dcae0372613e1..94e037696a82d 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsAction.java @@ -48,10 +48,10 @@ public class RestIndicesStatsAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_stats", GET), - new Route("/_stats/{metric}", GET), - new Route("/{index}/_stats", GET), - new Route("/{index}/_stats/{metric}", GET))); + new Route(GET, "/_stats"), + new Route(GET, "/_stats/{metric}"), + new Route(GET, "/{index}/_stats"), + new Route(GET, "/{index}/_stats/{metric}"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestOpenIndexAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestOpenIndexAction.java index 16f65bc3b5df3..3363f5d0f409a 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestOpenIndexAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestOpenIndexAction.java @@ -40,8 +40,8 @@ public class RestOpenIndexAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_open", POST), - new Route("/{index}/_open", POST))); + new Route(POST, "/_open"), + new Route(POST, "/{index}/_open"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutIndexTemplateAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutIndexTemplateAction.java index a3a6dac7a5820..41620b744027c 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutIndexTemplateAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutIndexTemplateAction.java @@ -41,8 +41,8 @@ public class RestPutIndexTemplateAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_template/{name}", POST), - new Route("/_template/{name}", PUT))); + new Route(POST, "/_template/{name}"), + new Route(PUT, "/_template/{name}"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutMappingAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutMappingAction.java index de837f1fa9e97..0ee08b3cb8774 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutMappingAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutMappingAction.java @@ -44,10 +44,10 @@ public class RestPutMappingAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/{index}/_mapping/", POST), - new Route("/{index}/_mapping/", PUT), - new Route("/{index}/_mappings/", POST), - new Route("/{index}/_mappings/", PUT))); + new Route(POST, "/{index}/_mapping/"), + new Route(PUT, "/{index}/_mapping/"), + new Route(POST, "/{index}/_mappings/"), + new Route(PUT, "/{index}/_mappings/"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRecoveryAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRecoveryAction.java index c908c143a2e22..793d3c9d23e76 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRecoveryAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRecoveryAction.java @@ -42,8 +42,8 @@ public class RestRecoveryAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_recovery", GET), - new Route("/{index}/_recovery", GET))); + new Route(GET, "/_recovery"), + new Route(GET, "/{index}/_recovery"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRefreshAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRefreshAction.java index 5f052cab74f93..52bc5df327de8 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRefreshAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRefreshAction.java @@ -42,10 +42,10 @@ public class RestRefreshAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_refresh", GET), - new Route("/_refresh", POST), - new Route("/{index}/_refresh", GET), - new Route("/{index}/_refresh", POST))); + new Route(GET, "/_refresh"), + new Route(POST, "/_refresh"), + new Route(GET, "/{index}/_refresh"), + new Route(POST, "/{index}/_refresh"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestResizeHandler.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestResizeHandler.java index 756d317979b53..9d1cfd6318cb5 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestResizeHandler.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestResizeHandler.java @@ -61,8 +61,8 @@ public static class RestShrinkIndexAction extends RestResizeHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/{index}/_shrink/{target}", POST), - new Route("/{index}/_shrink/{target}", PUT))); + new Route(POST, "/{index}/_shrink/{target}"), + new Route(PUT, "/{index}/_shrink/{target}"))); } @Override @@ -82,8 +82,8 @@ public static class RestSplitIndexAction extends RestResizeHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/{index}/_split/{target}", POST), - new Route("/{index}/_split/{target}", PUT))); + new Route(POST, "/{index}/_split/{target}"), + new Route(PUT, "/{index}/_split/{target}"))); } @Override @@ -103,8 +103,8 @@ public static class RestCloneIndexAction extends RestResizeHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/{index}/_clone/{target}", POST), - new Route("/{index}/_clone/{target}", PUT))); + new Route(POST, "/{index}/_clone/{target}"), + new Route(PUT, "/{index}/_clone/{target}"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRolloverIndexAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRolloverIndexAction.java index e2e083a5f3aac..08397c7c077c6 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRolloverIndexAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRolloverIndexAction.java @@ -38,8 +38,8 @@ public class RestRolloverIndexAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/{index}/_rollover", POST), - new Route("/{index}/_rollover/{new_index}", POST))); + new Route(POST, "/{index}/_rollover"), + new Route(POST, "/{index}/_rollover/{new_index}"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestSyncedFlushAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestSyncedFlushAction.java index 0fc8a9fbdedad..a8db872534bbb 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestSyncedFlushAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestSyncedFlushAction.java @@ -52,10 +52,10 @@ public class RestSyncedFlushAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_flush/synced", GET), - new Route("/_flush/synced", POST), - new Route("/{index}/_flush/synced", GET), - new Route("/{index}/_flush/synced", POST))); + new Route(GET, "/_flush/synced"), + new Route(POST, "/_flush/synced"), + new Route(GET, "/{index}/_flush/synced"), + new Route(POST, "/{index}/_flush/synced"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpdateSettingsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpdateSettingsAction.java index e313d6c920963..c02eb6ec3a3ec 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpdateSettingsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpdateSettingsAction.java @@ -42,8 +42,8 @@ public class RestUpdateSettingsAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/{index}/_settings", PUT), - new Route("/_settings", PUT))); + new Route(PUT, "/{index}/_settings"), + new Route(PUT, "/_settings"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpgradeActionDeprecated.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpgradeActionDeprecated.java index 962d74b8252bc..52307b0f33c66 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpgradeActionDeprecated.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpgradeActionDeprecated.java @@ -48,8 +48,8 @@ public class RestUpgradeActionDeprecated extends BaseRestHandler { @Override public List deprecatedRoutes() { return unmodifiableList(asList( - new DeprecatedRoute("/_upgrade", POST, UPGRADE_API_DEPRECATION_MESSAGE, deprecationLogger), - new DeprecatedRoute("/{index}/_upgrade", POST, UPGRADE_API_DEPRECATION_MESSAGE, deprecationLogger))); + new DeprecatedRoute(POST, "/_upgrade", UPGRADE_API_DEPRECATION_MESSAGE, deprecationLogger), + new DeprecatedRoute(POST, "/{index}/_upgrade", UPGRADE_API_DEPRECATION_MESSAGE, deprecationLogger))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpgradeStatusActionDeprecated.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpgradeStatusActionDeprecated.java index d9169efd7a8d5..36d97986884d9 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpgradeStatusActionDeprecated.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpgradeStatusActionDeprecated.java @@ -46,8 +46,8 @@ public class RestUpgradeStatusActionDeprecated extends BaseRestHandler { @Override public List deprecatedRoutes() { return unmodifiableList(asList( - new DeprecatedRoute("/_upgrade", GET, UPGRADE_API_DEPRECATION_MESSAGE, deprecationLogger), - new DeprecatedRoute("/{index}/_upgrade", GET, UPGRADE_API_DEPRECATION_MESSAGE, deprecationLogger))); + new DeprecatedRoute(GET, "/_upgrade", UPGRADE_API_DEPRECATION_MESSAGE, deprecationLogger), + new DeprecatedRoute(GET, "/{index}/_upgrade", UPGRADE_API_DEPRECATION_MESSAGE, deprecationLogger))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestValidateQueryAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestValidateQueryAction.java index 203e20c0028d2..162d6591e2184 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestValidateQueryAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestValidateQueryAction.java @@ -48,10 +48,10 @@ public class RestValidateQueryAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_validate/query", GET), - new Route("/_validate/query", POST), - new Route("/{index}/_validate/query", GET), - new Route("/{index}/_validate/query", POST))); + new Route(GET, "/_validate/query"), + new Route(POST, "/_validate/query"), + new Route(GET, "/{index}/_validate/query"), + new Route(POST, "/{index}/_validate/query"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestAliasAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestAliasAction.java index 805a41a5827c9..90356ca291ae3 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestAliasAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestAliasAction.java @@ -40,8 +40,8 @@ public class RestAliasAction extends AbstractCatAction { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_cat/aliases", GET), - new Route("/_cat/aliases/{alias}", GET))); + new Route(GET, "/_cat/aliases"), + new Route(GET, "/_cat/aliases/{alias}"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestAllocationAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestAllocationAction.java index 40005cc803f6e..7f1ca267a2c55 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestAllocationAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestAllocationAction.java @@ -49,8 +49,8 @@ public class RestAllocationAction extends AbstractCatAction { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_cat/allocation", GET), - new Route("/_cat/allocation/{nodes}", GET))); + new Route(GET, "/_cat/allocation"), + new Route(GET, "/_cat/allocation/{nodes}"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestCatAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestCatAction.java index 625797c8902e4..45a1d09bac535 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestCatAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestCatAction.java @@ -48,7 +48,7 @@ public RestCatAction(List catActions) { @Override public List handledRoutes() { - return singletonList(new Route("/_cat", GET)); + return singletonList(new Route(GET, "/_cat")); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestCatRecoveryAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestCatRecoveryAction.java index 19b54dec4de50..2d9f5774800b9 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestCatRecoveryAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestCatRecoveryAction.java @@ -54,8 +54,8 @@ public class RestCatRecoveryAction extends AbstractCatAction { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_cat/recovery", GET), - new Route("/_cat/recovery/{index}", GET))); + new Route(GET, "/_cat/recovery"), + new Route(GET, "/_cat/recovery/{index}"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestCountAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestCountAction.java index 68fc996252f0b..8ccb295ca0fda 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestCountAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestCountAction.java @@ -45,8 +45,8 @@ public class RestCountAction extends AbstractCatAction { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_cat/count", GET), - new Route("/_cat/count/{index}", GET))); + new Route(GET, "/_cat/count"), + new Route(GET, "/_cat/count/{index}"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestFielddataAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestFielddataAction.java index 42d8eedee437c..2909471f48156 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestFielddataAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestFielddataAction.java @@ -44,8 +44,8 @@ public class RestFielddataAction extends AbstractCatAction { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_cat/fielddata", GET), - new Route("/_cat/fielddata/{fields}", GET))); + new Route(GET, "/_cat/fielddata"), + new Route(GET, "/_cat/fielddata/{fields}"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestHealthAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestHealthAction.java index 0adec09a4c2ec..6971015de1beb 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestHealthAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestHealthAction.java @@ -37,7 +37,7 @@ public class RestHealthAction extends AbstractCatAction { @Override public List handledRoutes() { - return singletonList(new Route("/_cat/health", GET)); + return singletonList(new Route(GET, "/_cat/health")); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestIndicesAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestIndicesAction.java index 8c8e27635a339..72050525dcfb8 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestIndicesAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestIndicesAction.java @@ -73,8 +73,8 @@ public class RestIndicesAction extends AbstractCatAction { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_cat/indices", GET), - new Route("/_cat/indices/{index}", GET))); + new Route(GET, "/_cat/indices"), + new Route(GET, "/_cat/indices/{index}"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestMasterAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestMasterAction.java index b127f25cd68d3..040f6bfd0474b 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestMasterAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestMasterAction.java @@ -38,7 +38,7 @@ public class RestMasterAction extends AbstractCatAction { @Override public List handledRoutes() { - return singletonList(new Route("/_cat/master", GET)); + return singletonList(new Route(GET, "/_cat/master")); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodeAttrsAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodeAttrsAction.java index 71a39bef2ba40..e8ae2c924dcf3 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodeAttrsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodeAttrsAction.java @@ -44,7 +44,7 @@ public class RestNodeAttrsAction extends AbstractCatAction { @Override public List handledRoutes() { - return singletonList(new Route("/_cat/nodeattrs", GET)); + return singletonList(new Route(GET, "/_cat/nodeattrs")); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodesAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodesAction.java index 53230d97d6bd2..fbe82d847a1ba 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodesAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodesAction.java @@ -72,7 +72,7 @@ public class RestNodesAction extends AbstractCatAction { @Override public List handledRoutes() { - return singletonList(new Route("/_cat/nodes", GET)); + return singletonList(new Route(GET, "/_cat/nodes")); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestPendingClusterTasksAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestPendingClusterTasksAction.java index cd78abcf37d8f..4ecad5ec2060d 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestPendingClusterTasksAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestPendingClusterTasksAction.java @@ -37,7 +37,7 @@ public class RestPendingClusterTasksAction extends AbstractCatAction { @Override public List handledRoutes() { - return singletonList(new Route("/_cat/pending_tasks", GET)); + return singletonList(new Route(GET, "/_cat/pending_tasks")); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestPluginsAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestPluginsAction.java index 841e1e98390c4..ee7552647721e 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestPluginsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestPluginsAction.java @@ -43,7 +43,7 @@ public class RestPluginsAction extends AbstractCatAction { @Override public List handledRoutes() { - return singletonList(new Route("/_cat/plugins", GET)); + return singletonList(new Route(GET, "/_cat/plugins")); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestRepositoriesAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestRepositoriesAction.java index 0e0dcfdfe5827..d913c042dc13d 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestRepositoriesAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestRepositoriesAction.java @@ -40,7 +40,7 @@ public class RestRepositoriesAction extends AbstractCatAction { @Override public List handledRoutes() { - return singletonList(new Route("/_cat/repositories", GET)); + return singletonList(new Route(GET, "/_cat/repositories")); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestSegmentsAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestSegmentsAction.java index b604c6135e30b..e66862b594150 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestSegmentsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestSegmentsAction.java @@ -48,8 +48,8 @@ public class RestSegmentsAction extends AbstractCatAction { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_cat/segments", GET), - new Route("/_cat/segments/{index}", GET))); + new Route(GET, "/_cat/segments"), + new Route(GET, "/_cat/segments/{index}"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestShardsAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestShardsAction.java index 6f07cd7f14b2f..cd0cf91d63967 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestShardsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestShardsAction.java @@ -64,8 +64,8 @@ public class RestShardsAction extends AbstractCatAction { @Override public List handledRoutes() { - return unmodifiableList(asList(new Route("/_cat/shards", GET), - new Route("/_cat/shards/{index}", GET))); + return unmodifiableList(asList(new Route(GET, "/_cat/shards"), + new Route(GET, "/_cat/shards/{index}"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestSnapshotAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestSnapshotAction.java index 104b043fdcc16..91c95a50a27bc 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestSnapshotAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestSnapshotAction.java @@ -52,8 +52,8 @@ public class RestSnapshotAction extends AbstractCatAction { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_cat/snapshots", GET), - new Route("/_cat/snapshots/{repository}", GET))); + new Route(GET, "/_cat/snapshots"), + new Route(GET, "/_cat/snapshots/{repository}"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestTasksAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestTasksAction.java index b5115962ab40a..86dc518de7c8d 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestTasksAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestTasksAction.java @@ -56,7 +56,7 @@ public RestTasksAction(Supplier nodesInCluster) { @Override public List handledRoutes() { - return singletonList(new Route("/_cat/tasks", GET)); + return singletonList(new Route(GET, "/_cat/tasks")); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestTemplatesAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestTemplatesAction.java index 044c8c78cc239..3622d7529e70b 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestTemplatesAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestTemplatesAction.java @@ -42,8 +42,8 @@ public class RestTemplatesAction extends AbstractCatAction { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_cat/templates", GET), - new Route("/_cat/templates/{name}", GET))); + new Route(GET, "/_cat/templates"), + new Route(GET, "/_cat/templates/{name}"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestThreadPoolAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestThreadPoolAction.java index d9c63e264c9a4..c0b717380315f 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestThreadPoolAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestThreadPoolAction.java @@ -56,8 +56,8 @@ public class RestThreadPoolAction extends AbstractCatAction { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_cat/thread_pool", GET), - new Route("/_cat/thread_pool/{thread_pool_patterns}", GET))); + new Route(GET, "/_cat/thread_pool"), + new Route(GET, "/_cat/thread_pool/{thread_pool_patterns}"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/document/RestBulkAction.java b/server/src/main/java/org/elasticsearch/rest/action/document/RestBulkAction.java index 79d2708096cbd..88813c8878a15 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/document/RestBulkAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/document/RestBulkAction.java @@ -58,10 +58,10 @@ public RestBulkAction(Settings settings) { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_bulk", POST), - new Route("/_bulk", PUT), - new Route("/{index}/_bulk", POST), - new Route("/{index}/_bulk", PUT))); + new Route(POST, "/_bulk"), + new Route(PUT, "/_bulk"), + new Route(POST, "/{index}/_bulk"), + new Route(PUT, "/{index}/_bulk"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/document/RestDeleteAction.java b/server/src/main/java/org/elasticsearch/rest/action/document/RestDeleteAction.java index 4cd8796e80c9f..a0de9d9928a9a 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/document/RestDeleteAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/document/RestDeleteAction.java @@ -38,7 +38,7 @@ public class RestDeleteAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/{index}/_doc/{id}", DELETE)); + return singletonList(new Route(DELETE, "/{index}/_doc/{id}")); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/document/RestGetAction.java b/server/src/main/java/org/elasticsearch/rest/action/document/RestGetAction.java index 67a5927f99f62..11eb6575b60b2 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/document/RestGetAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/document/RestGetAction.java @@ -51,8 +51,8 @@ public String getName() { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/{index}/_doc/{id}", GET), - new Route("/{index}/_doc/{id}", HEAD))); + new Route(GET, "/{index}/_doc/{id}"), + new Route(HEAD, "/{index}/_doc/{id}"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/document/RestGetSourceAction.java b/server/src/main/java/org/elasticsearch/rest/action/document/RestGetSourceAction.java index 59fbef33a6ddf..cf0e92a5627dc 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/document/RestGetSourceAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/document/RestGetSourceAction.java @@ -53,8 +53,8 @@ public class RestGetSourceAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/{index}/_source/{id}", GET), - new Route("/{index}/_source/{id}", HEAD))); + new Route(GET, "/{index}/_source/{id}"), + new Route(HEAD, "/{index}/_source/{id}"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/document/RestIndexAction.java b/server/src/main/java/org/elasticsearch/rest/action/document/RestIndexAction.java index 11128bcf2046d..e2de8fdea410b 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/document/RestIndexAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/document/RestIndexAction.java @@ -45,8 +45,8 @@ public class RestIndexAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/{index}/_doc/{id}", POST), - new Route("/{index}/_doc/{id}", PUT))); + new Route(POST, "/{index}/_doc/{id}"), + new Route(PUT, "/{index}/_doc/{id}"))); } @Override @@ -64,8 +64,8 @@ public String getName() { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/{index}/_create/{id}", POST), - new Route("/{index}/_create/{id}", PUT))); + new Route(POST, "/{index}/_create/{id}"), + new Route(PUT, "/{index}/_create/{id}"))); } @Override @@ -97,7 +97,7 @@ public String getName() { @Override public List handledRoutes() { - return singletonList(new Route("/{index}/_doc", POST)); + return singletonList(new Route(POST, "/{index}/_doc")); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/document/RestMultiGetAction.java b/server/src/main/java/org/elasticsearch/rest/action/document/RestMultiGetAction.java index 48fd1ac3d35d3..c5554981107bf 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/document/RestMultiGetAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/document/RestMultiGetAction.java @@ -48,10 +48,10 @@ public RestMultiGetAction(Settings settings) { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_mget", GET), - new Route("/_mget", POST), - new Route("/{index}/_mget", GET), - new Route("/{index}/_mget", POST))); + new Route(GET, "/_mget"), + new Route(POST, "/_mget"), + new Route(GET, "/{index}/_mget"), + new Route(POST, "/{index}/_mget"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/document/RestMultiTermVectorsAction.java b/server/src/main/java/org/elasticsearch/rest/action/document/RestMultiTermVectorsAction.java index 0edf24547cebd..42279e7a75b77 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/document/RestMultiTermVectorsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/document/RestMultiTermVectorsAction.java @@ -40,10 +40,10 @@ public class RestMultiTermVectorsAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_mtermvectors", GET), - new Route("/_mtermvectors", POST), - new Route("/{index}/_mtermvectors", GET), - new Route("/{index}/_mtermvectors", POST))); + new Route(GET, "/_mtermvectors"), + new Route(POST, "/_mtermvectors"), + new Route(GET, "/{index}/_mtermvectors"), + new Route(POST, "/{index}/_mtermvectors"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/document/RestTermVectorsAction.java b/server/src/main/java/org/elasticsearch/rest/action/document/RestTermVectorsAction.java index 566b988ec9266..51deaa01ea837 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/document/RestTermVectorsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/document/RestTermVectorsAction.java @@ -48,10 +48,10 @@ public class RestTermVectorsAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/{index}/_termvectors", GET), - new Route("/{index}/_termvectors", POST), - new Route("/{index}/_termvectors/{id}", GET), - new Route("/{index}/_termvectors/{id}", POST))); + new Route(GET, "/{index}/_termvectors"), + new Route(POST, "/{index}/_termvectors"), + new Route(GET, "/{index}/_termvectors/{id}"), + new Route(POST, "/{index}/_termvectors/{id}"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/document/RestUpdateAction.java b/server/src/main/java/org/elasticsearch/rest/action/document/RestUpdateAction.java index de744f255cc8a..af1b99283e609 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/document/RestUpdateAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/document/RestUpdateAction.java @@ -41,7 +41,7 @@ public class RestUpdateAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/{index}/_update/{id}", POST)); + return singletonList(new Route(POST, "/{index}/_update/{id}")); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/ingest/RestDeletePipelineAction.java b/server/src/main/java/org/elasticsearch/rest/action/ingest/RestDeletePipelineAction.java index 0849a9b4bd661..1543a39bf5e6d 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/ingest/RestDeletePipelineAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/ingest/RestDeletePipelineAction.java @@ -34,7 +34,7 @@ public class RestDeletePipelineAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_ingest/pipeline/{id}", DELETE)); + return singletonList(new Route(DELETE, "/_ingest/pipeline/{id}")); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/ingest/RestGetPipelineAction.java b/server/src/main/java/org/elasticsearch/rest/action/ingest/RestGetPipelineAction.java index e23af78a01c22..6a5617a48f4c2 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/ingest/RestGetPipelineAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/ingest/RestGetPipelineAction.java @@ -38,8 +38,8 @@ public class RestGetPipelineAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_ingest/pipeline", GET), - new Route("/_ingest/pipeline/{id}", GET))); + new Route(GET, "/_ingest/pipeline"), + new Route(GET, "/_ingest/pipeline/{id}"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/ingest/RestPutPipelineAction.java b/server/src/main/java/org/elasticsearch/rest/action/ingest/RestPutPipelineAction.java index ea4cd85c5c429..173311e89e65e 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/ingest/RestPutPipelineAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/ingest/RestPutPipelineAction.java @@ -39,7 +39,7 @@ public class RestPutPipelineAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_ingest/pipeline/{id}", PUT)); + return singletonList(new Route(PUT, "/_ingest/pipeline/{id}")); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/ingest/RestSimulatePipelineAction.java b/server/src/main/java/org/elasticsearch/rest/action/ingest/RestSimulatePipelineAction.java index dfe5de212d38e..36e0d9f89606e 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/ingest/RestSimulatePipelineAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/ingest/RestSimulatePipelineAction.java @@ -41,10 +41,10 @@ public class RestSimulatePipelineAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_ingest/pipeline/{id}/_simulate", GET), - new Route("/_ingest/pipeline/{id}/_simulate", POST), - new Route("/_ingest/pipeline/_simulate", GET), - new Route("/_ingest/pipeline/_simulate", POST))); + new Route(GET, "/_ingest/pipeline/{id}/_simulate"), + new Route(POST, "/_ingest/pipeline/{id}/_simulate"), + new Route(GET, "/_ingest/pipeline/_simulate"), + new Route(POST, "/_ingest/pipeline/_simulate"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/search/RestClearScrollAction.java b/server/src/main/java/org/elasticsearch/rest/action/search/RestClearScrollAction.java index 97a413c1584ef..65b5bb959a991 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/search/RestClearScrollAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/search/RestClearScrollAction.java @@ -38,8 +38,8 @@ public class RestClearScrollAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_search/scroll", DELETE), - new Route("/_search/scroll/{scroll_id}", DELETE))); + new Route(DELETE, "/_search/scroll"), + new Route(DELETE, "/_search/scroll/{scroll_id}"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/search/RestCountAction.java b/server/src/main/java/org/elasticsearch/rest/action/search/RestCountAction.java index c1fe8edafc958..c3d258512609d 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/search/RestCountAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/search/RestCountAction.java @@ -49,10 +49,10 @@ public class RestCountAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_count", GET), - new Route("/_count", POST), - new Route("/{index}/_count", GET), - new Route("/{index}/_count", POST))); + new Route(GET, "/_count"), + new Route(POST, "/_count"), + new Route(GET, "/{index}/_count"), + new Route(POST, "/{index}/_count"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/search/RestExplainAction.java b/server/src/main/java/org/elasticsearch/rest/action/search/RestExplainAction.java index 5299a9fde31ce..494f137cb1387 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/search/RestExplainAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/search/RestExplainAction.java @@ -45,8 +45,8 @@ public class RestExplainAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/{index}/_explain/{id}", GET), - new Route("/{index}/_explain/{id}", POST))); + new Route(GET, "/{index}/_explain/{id}"), + new Route(POST, "/{index}/_explain/{id}"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/search/RestMultiSearchAction.java b/server/src/main/java/org/elasticsearch/rest/action/search/RestMultiSearchAction.java index 0e20ff4f0bb4a..93f1f856de7e9 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/search/RestMultiSearchAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/search/RestMultiSearchAction.java @@ -68,10 +68,10 @@ public RestMultiSearchAction(Settings settings) { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_msearch", GET), - new Route("/_msearch", POST), - new Route("/{index}/_msearch", GET), - new Route("/{index}/_msearch", POST))); + new Route(GET, "/_msearch"), + new Route(POST, "/_msearch"), + new Route(GET, "/{index}/_msearch"), + new Route(POST, "/{index}/_msearch"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java b/server/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java index c646fa36c3306..1eab74a1bd5f9 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java @@ -78,10 +78,10 @@ public String getName() { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_search", GET), - new Route("/_search", POST), - new Route("/{index}/_search", GET), - new Route("/{index}/_search", POST))); + new Route(GET, "/_search"), + new Route(POST, "/_search"), + new Route(GET, "/{index}/_search"), + new Route(POST, "/{index}/_search"))); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/search/RestSearchScrollAction.java b/server/src/main/java/org/elasticsearch/rest/action/search/RestSearchScrollAction.java index 81e8561e14c00..8ec72a62937ef 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/search/RestSearchScrollAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/search/RestSearchScrollAction.java @@ -48,10 +48,10 @@ public String getName() { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_search/scroll", GET), - new Route("/_search/scroll", POST), - new Route("/_search/scroll/{scroll_id}", GET), - new Route("/_search/scroll/{scroll_id}", POST))); + new Route(GET, "/_search/scroll"), + new Route(POST, "/_search/scroll"), + new Route(GET, "/_search/scroll/{scroll_id}"), + new Route(POST, "/_search/scroll/{scroll_id}"))); } @Override diff --git a/server/src/test/java/org/elasticsearch/action/ActionModuleTests.java b/server/src/test/java/org/elasticsearch/action/ActionModuleTests.java index 247da38d09fc9..5d70a0c98f7bf 100644 --- a/server/src/test/java/org/elasticsearch/action/ActionModuleTests.java +++ b/server/src/test/java/org/elasticsearch/action/ActionModuleTests.java @@ -120,7 +120,7 @@ public void handleRequest(RestRequest request, RestChannel channel, NodeClient c @Override public List handledRoutes() { - return singletonList(new Route("/", Method.GET)); + return singletonList(new Route(Method.GET, "/")); } })); assertThat(e.getMessage(), startsWith("Cannot replace existing handler for [/] for method: GET")); @@ -153,7 +153,7 @@ public void testPluginCanRegisterRestHandler() { class FakeHandler implements RestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_dummy", Method.GET)); + return singletonList(new Route(Method.GET, "/_dummy")); } @Override @@ -186,7 +186,7 @@ public void handleRequest(RestRequest request, RestChannel channel, NodeClient c @Override public List handledRoutes() { - return singletonList(new Route("/_dummy", Method.GET)); + return singletonList(new Route(Method.GET, "/_dummy")); } })); assertThat(e.getMessage(), startsWith("Cannot replace existing handler for [/_dummy] for method: GET")); diff --git a/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/rest/RestGetAutoscalingDecisionHandler.java b/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/rest/RestGetAutoscalingDecisionHandler.java index 6da492a3f3277..2164065eae406 100644 --- a/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/rest/RestGetAutoscalingDecisionHandler.java +++ b/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/rest/RestGetAutoscalingDecisionHandler.java @@ -21,7 +21,7 @@ public class RestGetAutoscalingDecisionHandler extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_autoscaling/decision", GET)); + return singletonList(new Route(GET, "/_autoscaling/decision")); } @Override diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestCcrStatsAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestCcrStatsAction.java index 7c41f5d7b2410..f22368b3e442d 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestCcrStatsAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestCcrStatsAction.java @@ -21,7 +21,7 @@ public class RestCcrStatsAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_ccr/stats", GET)); + return singletonList(new Route(GET, "/_ccr/stats")); } @Override diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestDeleteAutoFollowPatternAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestDeleteAutoFollowPatternAction.java index 5519f281fa6d1..ece99212dab10 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestDeleteAutoFollowPatternAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestDeleteAutoFollowPatternAction.java @@ -21,7 +21,7 @@ public class RestDeleteAutoFollowPatternAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_ccr/auto_follow/{name}", DELETE)); + return singletonList(new Route(DELETE, "/_ccr/auto_follow/{name}")); } @Override diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestFollowInfoAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestFollowInfoAction.java index ebad7c2e7016b..077dd190dc3d9 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestFollowInfoAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestFollowInfoAction.java @@ -22,7 +22,7 @@ public class RestFollowInfoAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/{index}/_ccr/info", GET)); + return singletonList(new Route(GET, "/{index}/_ccr/info")); } @Override diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestFollowStatsAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestFollowStatsAction.java index 26bc2edc220bc..030ae367fa87f 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestFollowStatsAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestFollowStatsAction.java @@ -22,7 +22,7 @@ public class RestFollowStatsAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/{index}/_ccr/stats", GET)); + return singletonList(new Route(GET, "/{index}/_ccr/stats")); } @Override diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestForgetFollowerAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestForgetFollowerAction.java index 20eed34c6f3de..ee8c79ff2c374 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestForgetFollowerAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestForgetFollowerAction.java @@ -24,7 +24,7 @@ public class RestForgetFollowerAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/{index}/_ccr/forget_follower", POST)); + return singletonList(new Route(POST, "/{index}/_ccr/forget_follower")); } @Override diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestGetAutoFollowPatternAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestGetAutoFollowPatternAction.java index 67e5c8b1b49d5..75f63ece47233 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestGetAutoFollowPatternAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestGetAutoFollowPatternAction.java @@ -23,8 +23,8 @@ public class RestGetAutoFollowPatternAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_ccr/auto_follow/{name}", GET), - new Route("/_ccr/auto_follow", GET))); + new Route(GET, "/_ccr/auto_follow/{name}"), + new Route(GET, "/_ccr/auto_follow"))); } @Override diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPauseAutoFollowPatternAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPauseAutoFollowPatternAction.java index a1adb12ad6c57..6e5e6f8648b66 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPauseAutoFollowPatternAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPauseAutoFollowPatternAction.java @@ -21,7 +21,7 @@ public class RestPauseAutoFollowPatternAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_ccr/auto_follow/{name}/pause", POST)); + return singletonList(new Route(POST, "/_ccr/auto_follow/{name}/pause")); } @Override diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPauseFollowAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPauseFollowAction.java index 7cee2e1320170..669c412b80696 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPauseFollowAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPauseFollowAction.java @@ -21,7 +21,7 @@ public class RestPauseFollowAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/{index}/_ccr/pause_follow", POST)); + return singletonList(new Route(POST, "/{index}/_ccr/pause_follow")); } @Override diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPutAutoFollowPatternAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPutAutoFollowPatternAction.java index e4ec9887607f5..cc411f47d3b1f 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPutAutoFollowPatternAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPutAutoFollowPatternAction.java @@ -23,7 +23,7 @@ public class RestPutAutoFollowPatternAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_ccr/auto_follow/{name}", PUT)); + return singletonList(new Route(PUT, "/_ccr/auto_follow/{name}")); } @Override diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPutFollowAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPutFollowAction.java index 86b90ca9ab97e..128464ca0ffb2 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPutFollowAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPutFollowAction.java @@ -24,7 +24,7 @@ public class RestPutFollowAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/{index}/_ccr/follow", PUT)); + return singletonList(new Route(PUT, "/{index}/_ccr/follow")); } @Override diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestResumeAutoFollowPatternAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestResumeAutoFollowPatternAction.java index a31660bbd1172..1c321e5768e3e 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestResumeAutoFollowPatternAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestResumeAutoFollowPatternAction.java @@ -21,7 +21,7 @@ public class RestResumeAutoFollowPatternAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_ccr/auto_follow/{name}/resume", POST)); + return singletonList(new Route(POST, "/_ccr/auto_follow/{name}/resume")); } @Override diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestResumeFollowAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestResumeFollowAction.java index 8a3f05636dba6..53547999ac7a7 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestResumeFollowAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestResumeFollowAction.java @@ -23,7 +23,7 @@ public class RestResumeFollowAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/{index}/_ccr/resume_follow", POST)); + return singletonList(new Route(POST, "/{index}/_ccr/resume_follow")); } @Override diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestUnfollowAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestUnfollowAction.java index e3498d70a01ba..35b037bec4acc 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestUnfollowAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestUnfollowAction.java @@ -22,7 +22,7 @@ public class RestUnfollowAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/{index}/_ccr/unfollow", POST)); + return singletonList(new Route(POST, "/{index}/_ccr/unfollow")); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestDeleteLicenseAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestDeleteLicenseAction.java index 58351c3704793..554f3da36f450 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestDeleteLicenseAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestDeleteLicenseAction.java @@ -24,7 +24,7 @@ public class RestDeleteLicenseAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_license", DELETE)); + return singletonList(new Route(DELETE, "/_license")); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetBasicStatus.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetBasicStatus.java index ddafdca84a6ba..ac48fc981fa0d 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetBasicStatus.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetBasicStatus.java @@ -22,7 +22,7 @@ public class RestGetBasicStatus extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_license/basic_status", GET)); + return singletonList(new Route(GET, "/_license/basic_status")); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetLicenseAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetLicenseAction.java index edba7c14729ae..85ca1e061e135 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetLicenseAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetLicenseAction.java @@ -36,7 +36,7 @@ public class RestGetLicenseAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_license", GET)); + return singletonList(new Route(GET, "/_license")); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetTrialStatus.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetTrialStatus.java index bd0584ae39285..29d046436bf38 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetTrialStatus.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetTrialStatus.java @@ -22,7 +22,7 @@ public class RestGetTrialStatus extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_license/trial_status", GET)); + return singletonList(new Route(GET, "/_license/trial_status")); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPostStartBasicLicense.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPostStartBasicLicense.java index 40d58a215ff2c..792a9705f26e1 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPostStartBasicLicense.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPostStartBasicLicense.java @@ -23,7 +23,7 @@ public class RestPostStartBasicLicense extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_license/start_basic", POST)); + return singletonList(new Route(POST, "/_license/start_basic")); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPostStartTrialLicense.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPostStartTrialLicense.java index 7753acd330686..bf5430a7c8303 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPostStartTrialLicense.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPostStartTrialLicense.java @@ -27,7 +27,7 @@ public class RestPostStartTrialLicense extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_license/start_trial", POST)); + return singletonList(new Route(POST, "/_license/start_trial")); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPutLicenseAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPutLicenseAction.java index 21827743bc563..f6be2e4229c34 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPutLicenseAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPutLicenseAction.java @@ -27,8 +27,8 @@ public class RestPutLicenseAction extends BaseRestHandler { public List handledRoutes() { // TODO: remove POST endpoint? return unmodifiableList(asList( - new Route("/_license", POST), - new Route("/_license", PUT))); + new Route(POST, "/_license"), + new Route(PUT, "/_license"))); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rest/action/RestReloadAnalyzersAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rest/action/RestReloadAnalyzersAction.java index 04c74e354b8b0..d4f957f22e9e2 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rest/action/RestReloadAnalyzersAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rest/action/RestReloadAnalyzersAction.java @@ -27,8 +27,8 @@ public class RestReloadAnalyzersAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/{index}/_reload_search_analyzers", GET), - new Route("/{index}/_reload_search_analyzers", POST))); + new Route(GET, "/{index}/_reload_search_analyzers"), + new Route(POST, "/{index}/_reload_search_analyzers"))); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rest/action/RestXPackInfoAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rest/action/RestXPackInfoAction.java index 0ea34bc6ae43c..c80b35c0f1939 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rest/action/RestXPackInfoAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rest/action/RestXPackInfoAction.java @@ -26,8 +26,8 @@ public class RestXPackInfoAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_xpack", GET), - new Route("/_xpack", HEAD))); + new Route(GET, "/_xpack"), + new Route(HEAD, "/_xpack"))); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rest/action/RestXPackUsageAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rest/action/RestXPackUsageAction.java index 4b89d4789583c..3eb6570674758 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rest/action/RestXPackUsageAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rest/action/RestXPackUsageAction.java @@ -29,7 +29,7 @@ public class RestXPackUsageAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_xpack/usage", GET)); + return singletonList(new Route(GET, "/_xpack/usage")); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/rest/RestGetCertificateInfoAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/rest/RestGetCertificateInfoAction.java index e5efc7f17010d..56a2ad1669397 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/rest/RestGetCertificateInfoAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/rest/RestGetCertificateInfoAction.java @@ -29,7 +29,7 @@ public class RestGetCertificateInfoAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_ssl/certificates", GET)); + return singletonList(new Route(GET, "/_ssl/certificates")); } @Override diff --git a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/RestDeprecationInfoAction.java b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/RestDeprecationInfoAction.java index dd8a4757f40dd..cc45effd94ef2 100644 --- a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/RestDeprecationInfoAction.java +++ b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/RestDeprecationInfoAction.java @@ -25,8 +25,8 @@ public class RestDeprecationInfoAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_migration/deprecations", GET), - new Route("/{index}/_migration/deprecations", GET))); + new Route(GET, "/_migration/deprecations"), + new Route(GET, "/{index}/_migration/deprecations"))); } @Override diff --git a/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestDeleteEnrichPolicyAction.java b/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestDeleteEnrichPolicyAction.java index cc42d96763944..57ad67c4cdb10 100644 --- a/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestDeleteEnrichPolicyAction.java +++ b/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestDeleteEnrichPolicyAction.java @@ -21,7 +21,7 @@ public class RestDeleteEnrichPolicyAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_enrich/policy/{name}", DELETE)); + return singletonList(new Route(DELETE, "/_enrich/policy/{name}")); } @Override diff --git a/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestEnrichStatsAction.java b/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestEnrichStatsAction.java index 01ac4eb751e58..8727be5cb56c3 100644 --- a/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestEnrichStatsAction.java +++ b/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestEnrichStatsAction.java @@ -21,7 +21,7 @@ public class RestEnrichStatsAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_enrich/_stats", GET)); + return singletonList(new Route(GET, "/_enrich/_stats")); } @Override diff --git a/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestExecuteEnrichPolicyAction.java b/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestExecuteEnrichPolicyAction.java index 63066d1b56bf7..d944b5a0b3111 100644 --- a/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestExecuteEnrichPolicyAction.java +++ b/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestExecuteEnrichPolicyAction.java @@ -24,7 +24,7 @@ public class RestExecuteEnrichPolicyAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList( - asList(new Route("/_enrich/policy/{name}/_execute", POST), new Route("/_enrich/policy/{name}/_execute", PUT)) + asList(new Route(POST, "/_enrich/policy/{name}/_execute"), new Route(PUT, "/_enrich/policy/{name}/_execute")) ); } diff --git a/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestGetEnrichPolicyAction.java b/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestGetEnrichPolicyAction.java index c2f5ca9fd6adf..3c146a5de1777 100644 --- a/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestGetEnrichPolicyAction.java +++ b/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestGetEnrichPolicyAction.java @@ -23,7 +23,7 @@ public class RestGetEnrichPolicyAction extends BaseRestHandler { @Override public List handledRoutes() { - return unmodifiableList(asList(new Route("/_enrich/policy/{name}", GET), new Route("/_enrich/policy", GET))); + return unmodifiableList(asList(new Route(GET, "/_enrich/policy/{name}"), new Route(GET, "/_enrich/policy"))); } @Override diff --git a/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestPutEnrichPolicyAction.java b/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestPutEnrichPolicyAction.java index c2d2c3dce61c6..1ed51cbc7d384 100644 --- a/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestPutEnrichPolicyAction.java +++ b/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestPutEnrichPolicyAction.java @@ -22,7 +22,7 @@ public class RestPutEnrichPolicyAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_enrich/policy/{name}", PUT)); + return singletonList(new Route(PUT, "/_enrich/policy/{name}")); } @Override diff --git a/x-pack/plugin/eql/src/main/java/org/elasticsearch/xpack/eql/plugin/RestEqlSearchAction.java b/x-pack/plugin/eql/src/main/java/org/elasticsearch/xpack/eql/plugin/RestEqlSearchAction.java index 2091bc21365f0..1a4b23f6ec99f 100644 --- a/x-pack/plugin/eql/src/main/java/org/elasticsearch/xpack/eql/plugin/RestEqlSearchAction.java +++ b/x-pack/plugin/eql/src/main/java/org/elasticsearch/xpack/eql/plugin/RestEqlSearchAction.java @@ -34,8 +34,8 @@ public class RestEqlSearchAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route(SEARCH_PATH, GET), - new Route(SEARCH_PATH, POST))); + new Route(GET, SEARCH_PATH), + new Route(POST, SEARCH_PATH))); } @Override diff --git a/x-pack/plugin/frozen-indices/src/main/java/org/elasticsearch/xpack/frozen/rest/action/RestFreezeIndexAction.java b/x-pack/plugin/frozen-indices/src/main/java/org/elasticsearch/xpack/frozen/rest/action/RestFreezeIndexAction.java index 558df47869290..aa7e941de32da 100644 --- a/x-pack/plugin/frozen-indices/src/main/java/org/elasticsearch/xpack/frozen/rest/action/RestFreezeIndexAction.java +++ b/x-pack/plugin/frozen-indices/src/main/java/org/elasticsearch/xpack/frozen/rest/action/RestFreezeIndexAction.java @@ -26,8 +26,8 @@ public final class RestFreezeIndexAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/{index}/_freeze", POST), - new Route("/{index}/_unfreeze", POST))); + new Route(POST, "/{index}/_freeze"), + new Route(POST, "/{index}/_unfreeze"))); } @Override diff --git a/x-pack/plugin/graph/src/main/java/org/elasticsearch/xpack/graph/rest/action/RestGraphAction.java b/x-pack/plugin/graph/src/main/java/org/elasticsearch/xpack/graph/rest/action/RestGraphAction.java index b4dd46c404507..b6c6dbc22b391 100644 --- a/x-pack/plugin/graph/src/main/java/org/elasticsearch/xpack/graph/rest/action/RestGraphAction.java +++ b/x-pack/plugin/graph/src/main/java/org/elasticsearch/xpack/graph/rest/action/RestGraphAction.java @@ -61,8 +61,8 @@ public class RestGraphAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/{index}/_graph/explore", GET), - new Route("/{index}/_graph/explore", POST))); + new Route(GET, "/{index}/_graph/explore"), + new Route(POST, "/{index}/_graph/explore"))); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestDeleteLifecycleAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestDeleteLifecycleAction.java index 5602686d44af7..221c39850d276 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestDeleteLifecycleAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestDeleteLifecycleAction.java @@ -21,7 +21,7 @@ public class RestDeleteLifecycleAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_ilm/policy/{name}", DELETE)); + return singletonList(new Route(DELETE, "/_ilm/policy/{name}")); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestExplainLifecycleAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestExplainLifecycleAction.java index da838842b6b88..50cbcca649de9 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestExplainLifecycleAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestExplainLifecycleAction.java @@ -24,7 +24,7 @@ public class RestExplainLifecycleAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/{index}/_ilm/explain", GET)); + return singletonList(new Route(GET, "/{index}/_ilm/explain")); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestGetLifecycleAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestGetLifecycleAction.java index 333e90cc53ce0..f858af2632c79 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestGetLifecycleAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestGetLifecycleAction.java @@ -24,8 +24,8 @@ public class RestGetLifecycleAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_ilm/policy", GET), - new Route("/_ilm/policy/{name}", GET))); + new Route(GET, "/_ilm/policy"), + new Route(GET, "/_ilm/policy/{name}"))); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestGetStatusAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestGetStatusAction.java index 41b92b5ae608a..0a7f0406322ce 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestGetStatusAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestGetStatusAction.java @@ -21,7 +21,7 @@ public class RestGetStatusAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_ilm/status", GET)); + return singletonList(new Route(GET, "/_ilm/status")); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestMoveToStepAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestMoveToStepAction.java index 6ffc34f84bbae..f1b19942b9608 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestMoveToStepAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestMoveToStepAction.java @@ -24,7 +24,7 @@ public class RestMoveToStepAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_ilm/move/{name}", POST)); + return singletonList(new Route(POST, "/_ilm/move/{name}")); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestPutLifecycleAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestPutLifecycleAction.java index 1181e99bd7edf..493b7fd317a16 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestPutLifecycleAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestPutLifecycleAction.java @@ -23,7 +23,7 @@ public class RestPutLifecycleAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_ilm/policy/{name}", PUT)); + return singletonList(new Route(PUT, "/_ilm/policy/{name}")); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestRemoveIndexLifecyclePolicyAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestRemoveIndexLifecyclePolicyAction.java index 27b0dea7b4a8b..9fed8b0c10901 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestRemoveIndexLifecyclePolicyAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestRemoveIndexLifecyclePolicyAction.java @@ -23,7 +23,7 @@ public class RestRemoveIndexLifecyclePolicyAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/{index}/_ilm/remove", POST)); + return singletonList(new Route(POST, "/{index}/_ilm/remove")); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestRetryAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestRetryAction.java index 55ce43f3283b2..c42c799d887c0 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestRetryAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestRetryAction.java @@ -24,7 +24,7 @@ public class RestRetryAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/{index}/_ilm/retry", POST)); + return singletonList(new Route(POST, "/{index}/_ilm/retry")); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestStartILMAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestStartILMAction.java index bed7a4fae38f2..d1df3cbb0881c 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestStartILMAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestStartILMAction.java @@ -22,7 +22,7 @@ public class RestStartILMAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_ilm/start", POST)); + return singletonList(new Route(POST, "/_ilm/start")); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestStopAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestStopAction.java index fe5f12d40fb55..befbd911d5449 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestStopAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestStopAction.java @@ -22,7 +22,7 @@ public class RestStopAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_ilm/stop", POST)); + return singletonList(new Route(POST, "/_ilm/stop")); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestDeleteSnapshotLifecycleAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestDeleteSnapshotLifecycleAction.java index c2cb848f7615c..f7cdd1a0463aa 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestDeleteSnapshotLifecycleAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestDeleteSnapshotLifecycleAction.java @@ -21,7 +21,7 @@ public class RestDeleteSnapshotLifecycleAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_slm/policy/{name}", DELETE)); + return singletonList(new Route(DELETE, "/_slm/policy/{name}")); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestExecuteSnapshotLifecycleAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestExecuteSnapshotLifecycleAction.java index e5f6bd7e9355b..56c889901e610 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestExecuteSnapshotLifecycleAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestExecuteSnapshotLifecycleAction.java @@ -24,8 +24,8 @@ public class RestExecuteSnapshotLifecycleAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_slm/policy/{name}/_execute", POST), - new Route("/_slm/policy/{name}/_execute", PUT))); + new Route(POST, "/_slm/policy/{name}/_execute"), + new Route(PUT, "/_slm/policy/{name}/_execute"))); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestExecuteSnapshotRetentionAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestExecuteSnapshotRetentionAction.java index 1acb00c2b0574..3c48edf3bb1f1 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestExecuteSnapshotRetentionAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestExecuteSnapshotRetentionAction.java @@ -21,7 +21,7 @@ public class RestExecuteSnapshotRetentionAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_slm/_execute_retention", POST)); + return singletonList(new Route(POST, "/_slm/_execute_retention")); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestGetSLMStatusAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestGetSLMStatusAction.java index 32c99b3e57a67..34ffd979d7a06 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestGetSLMStatusAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestGetSLMStatusAction.java @@ -21,7 +21,7 @@ public class RestGetSLMStatusAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_slm/status", GET)); + return singletonList(new Route(GET, "/_slm/status")); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestGetSnapshotLifecycleAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestGetSnapshotLifecycleAction.java index ab7325083fee8..31fdfa4f4e2f2 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestGetSnapshotLifecycleAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestGetSnapshotLifecycleAction.java @@ -24,8 +24,8 @@ public class RestGetSnapshotLifecycleAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_slm/policy", GET), - new Route("/_slm/policy/{name}", GET))); + new Route(GET, "/_slm/policy"), + new Route(GET, "/_slm/policy/{name}"))); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestGetSnapshotLifecycleStatsAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestGetSnapshotLifecycleStatsAction.java index bd1506fd5152f..b76340d90bc1b 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestGetSnapshotLifecycleStatsAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestGetSnapshotLifecycleStatsAction.java @@ -21,7 +21,7 @@ public class RestGetSnapshotLifecycleStatsAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_slm/stats", GET)); + return singletonList(new Route(GET, "/_slm/stats")); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestPutSnapshotLifecycleAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestPutSnapshotLifecycleAction.java index dcf649324992e..8fa8fafef2a2d 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestPutSnapshotLifecycleAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestPutSnapshotLifecycleAction.java @@ -23,7 +23,7 @@ public class RestPutSnapshotLifecycleAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_slm/policy/{name}", PUT)); + return singletonList(new Route(PUT, "/_slm/policy/{name}")); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestStartSLMAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestStartSLMAction.java index 5d3f77f654732..8bb8d1d0ce086 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestStartSLMAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestStartSLMAction.java @@ -21,7 +21,7 @@ public class RestStartSLMAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_slm/start", POST)); + return singletonList(new Route(POST, "/_slm/start")); } @Override diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestStopSLMAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestStopSLMAction.java index d09e33821e771..9a4c11d2c8672 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestStopSLMAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestStopSLMAction.java @@ -21,7 +21,7 @@ public class RestStopSLMAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_slm/stop", POST)); + return singletonList(new Route(POST, "/_slm/stop")); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/cat/RestCatDatafeedsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/cat/RestCatDatafeedsAction.java index 7009de7cd3181..19967ab82146f 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/cat/RestCatDatafeedsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/cat/RestCatDatafeedsAction.java @@ -30,8 +30,8 @@ public class RestCatDatafeedsAction extends AbstractCatAction { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("_cat/ml/datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}", GET), - new Route("_cat/ml/datafeeds", GET))); + new Route(GET, "_cat/ml/datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}"), + new Route(GET, "_cat/ml/datafeeds"))); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/cat/RestCatJobsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/cat/RestCatJobsAction.java index d82d50428f192..b826f9d644474 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/cat/RestCatJobsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/cat/RestCatJobsAction.java @@ -35,8 +35,8 @@ public class RestCatJobsAction extends AbstractCatAction { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("_cat/ml/anomaly_detectors/{" + Job.ID.getPreferredName() + "}", GET), - new Route("_cat/ml/anomaly_detectors", GET))); + new Route(GET, "_cat/ml/anomaly_detectors/{" + Job.ID.getPreferredName() + "}"), + new Route(GET, "_cat/ml/anomaly_detectors"))); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/cat/RestCatTrainedModelsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/cat/RestCatTrainedModelsAction.java index 80dde77a7ab87..b31fde9168763 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/cat/RestCatTrainedModelsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/cat/RestCatTrainedModelsAction.java @@ -47,8 +47,8 @@ public class RestCatTrainedModelsAction extends AbstractCatAction { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("_cat/ml/trained_models", GET), - new Route("_cat/ml/trained_models/{" + TrainedModelConfig.MODEL_ID.getPreferredName() + "}", GET))); + new Route(GET, "_cat/ml/trained_models"), + new Route(GET, "_cat/ml/trained_models/{" + TrainedModelConfig.MODEL_ID.getPreferredName() + "}"))); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestDeleteDataFrameAnalyticsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestDeleteDataFrameAnalyticsAction.java index a28aca5fa8c63..2b59cb43471e0 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestDeleteDataFrameAnalyticsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestDeleteDataFrameAnalyticsAction.java @@ -24,7 +24,7 @@ public class RestDeleteDataFrameAnalyticsAction extends BaseRestHandler { @Override public List handledRoutes() { return singletonList( - new Route(MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}", DELETE)); + new Route(DELETE, MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}")); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestEvaluateDataFrameAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestEvaluateDataFrameAction.java index 344a34f3dbe72..d2bc547b7bc20 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestEvaluateDataFrameAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestEvaluateDataFrameAction.java @@ -22,7 +22,7 @@ public class RestEvaluateDataFrameAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route(MachineLearning.BASE_PATH + "data_frame/_evaluate", POST)); + return singletonList(new Route(POST, MachineLearning.BASE_PATH + "data_frame/_evaluate")); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestExplainDataFrameAnalyticsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestExplainDataFrameAnalyticsAction.java index 0795672c0991e..2c371be317239 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestExplainDataFrameAnalyticsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestExplainDataFrameAnalyticsAction.java @@ -32,12 +32,12 @@ public class RestExplainDataFrameAnalyticsAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route(MachineLearning.BASE_PATH + "data_frame/analytics/_explain", GET), - new Route(MachineLearning.BASE_PATH + "data_frame/analytics/_explain", POST), - new Route(MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}/_explain", - GET), - new Route(MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}/_explain", - POST))); + new Route(GET, MachineLearning.BASE_PATH + "data_frame/analytics/_explain"), + new Route(POST, MachineLearning.BASE_PATH + "data_frame/analytics/_explain"), + new Route(GET, MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}/_explain" + ), + new Route(POST, MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}/_explain" + ))); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestGetDataFrameAnalyticsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestGetDataFrameAnalyticsAction.java index e0b0075aad2a9..5a6ba13533b7f 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestGetDataFrameAnalyticsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestGetDataFrameAnalyticsAction.java @@ -27,8 +27,8 @@ public class RestGetDataFrameAnalyticsAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route(MachineLearning.BASE_PATH + "data_frame/analytics", GET), - new Route(MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}", GET))); + new Route(GET, MachineLearning.BASE_PATH + "data_frame/analytics"), + new Route(GET, MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}"))); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestGetDataFrameAnalyticsStatsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestGetDataFrameAnalyticsStatsAction.java index c3d418fc0c40d..21bee38a34336 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestGetDataFrameAnalyticsStatsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestGetDataFrameAnalyticsStatsAction.java @@ -27,9 +27,9 @@ public class RestGetDataFrameAnalyticsStatsAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route(MachineLearning.BASE_PATH + "data_frame/analytics/_stats", GET), - new Route(MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}/_stats", - GET))); + new Route(GET, MachineLearning.BASE_PATH + "data_frame/analytics/_stats"), + new Route(GET, MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}/_stats" + ))); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestPutDataFrameAnalyticsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestPutDataFrameAnalyticsAction.java index 13ef23240b80a..f2764160773ef 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestPutDataFrameAnalyticsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestPutDataFrameAnalyticsAction.java @@ -25,7 +25,7 @@ public class RestPutDataFrameAnalyticsAction extends BaseRestHandler { @Override public List handledRoutes() { return singletonList( - new Route(MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}", PUT)); + new Route(PUT, MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}")); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestStartDataFrameAnalyticsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestStartDataFrameAnalyticsAction.java index f099002925e5f..e8ee2c6fb0be4 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestStartDataFrameAnalyticsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestStartDataFrameAnalyticsAction.java @@ -25,8 +25,8 @@ public class RestStartDataFrameAnalyticsAction extends BaseRestHandler { @Override public List handledRoutes() { return singletonList( - new Route(MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}/_start", - POST)); + new Route(POST, MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}/_start" + )); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestStopDataFrameAnalyticsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestStopDataFrameAnalyticsAction.java index 5260359b57653..38ce2954738d1 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestStopDataFrameAnalyticsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestStopDataFrameAnalyticsAction.java @@ -24,8 +24,8 @@ public class RestStopDataFrameAnalyticsAction extends BaseRestHandler { @Override public List handledRoutes() { return singletonList( - new Route(MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}/_stop", - POST)); + new Route(POST, MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}/_stop" + )); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestDeleteTrainedModelAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestDeleteTrainedModelAction.java index 2709b1ad7cbb1..50394e2ae757d 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestDeleteTrainedModelAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestDeleteTrainedModelAction.java @@ -24,7 +24,7 @@ public class RestDeleteTrainedModelAction extends BaseRestHandler { @Override public List handledRoutes() { return singletonList( - new Route(MachineLearning.BASE_PATH + "inference/{" + TrainedModelConfig.MODEL_ID.getPreferredName() + "}", DELETE)); + new Route(DELETE, MachineLearning.BASE_PATH + "inference/{" + TrainedModelConfig.MODEL_ID.getPreferredName() + "}")); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestGetTrainedModelsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestGetTrainedModelsAction.java index 15292373baeb1..f0228c892e2b7 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestGetTrainedModelsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestGetTrainedModelsAction.java @@ -31,8 +31,8 @@ public class RestGetTrainedModelsAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route(MachineLearning.BASE_PATH + "inference/{" + TrainedModelConfig.MODEL_ID.getPreferredName() + "}", GET), - new Route(MachineLearning.BASE_PATH + "inference", GET))); + new Route(GET, MachineLearning.BASE_PATH + "inference/{" + TrainedModelConfig.MODEL_ID.getPreferredName() + "}"), + new Route(GET, MachineLearning.BASE_PATH + "inference"))); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestGetTrainedModelsStatsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestGetTrainedModelsStatsAction.java index d97fae9f664cc..050e846adc856 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestGetTrainedModelsStatsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestGetTrainedModelsStatsAction.java @@ -29,8 +29,8 @@ public class RestGetTrainedModelsStatsAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route(MachineLearning.BASE_PATH + "inference/{" + TrainedModelConfig.MODEL_ID.getPreferredName() + "}/_stats", GET), - new Route(MachineLearning.BASE_PATH + MachineLearning.BASE_PATH + "inference/_stats", GET))); + new Route(GET, MachineLearning.BASE_PATH + "inference/{" + TrainedModelConfig.MODEL_ID.getPreferredName() + "}/_stats"), + new Route(GET, MachineLearning.BASE_PATH + MachineLearning.BASE_PATH + "inference/_stats"))); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestPutTrainedModelAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestPutTrainedModelAction.java index ba536ede14709..f14228c3a5555 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestPutTrainedModelAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestPutTrainedModelAction.java @@ -25,7 +25,7 @@ public class RestPutTrainedModelAction extends BaseRestHandler { @Override public List handledRoutes() { return singletonList( - new Route(MachineLearning.BASE_PATH + "inference/{" + TrainedModelConfig.MODEL_ID.getPreferredName() + "}", PUT)); + new Route(PUT, MachineLearning.BASE_PATH + "inference/{" + TrainedModelConfig.MODEL_ID.getPreferredName() + "}")); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestDeleteForecastAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestDeleteForecastAction.java index be227b8f5ac1f..ce7daad41ced3 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestDeleteForecastAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestDeleteForecastAction.java @@ -31,7 +31,7 @@ public class RestDeleteForecastAction extends BaseRestHandler { @Override public List handledRoutes() { return singletonList( - new Route(MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_forecast/", DELETE)); + new Route(DELETE, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_forecast/")); } @Override diff --git a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/rest/action/RestMonitoringBulkAction.java b/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/rest/action/RestMonitoringBulkAction.java index db372c5fcaa84..dba11fba2cf21 100644 --- a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/rest/action/RestMonitoringBulkAction.java +++ b/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/rest/action/RestMonitoringBulkAction.java @@ -50,8 +50,8 @@ public class RestMonitoringBulkAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_monitoring/bulk", POST), - new Route("/_monitoring/bulk", PUT))); + new Route(POST, "/_monitoring/bulk"), + new Route(PUT, "/_monitoring/bulk"))); } @Override diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestDeleteRollupJobAction.java b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestDeleteRollupJobAction.java index 12fec56c5f22d..afadec1e580dc 100644 --- a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestDeleteRollupJobAction.java +++ b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestDeleteRollupJobAction.java @@ -25,7 +25,7 @@ public class RestDeleteRollupJobAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_rollup/job/{id}", DELETE)); + return singletonList(new Route(DELETE, "/_rollup/job/{id}")); } @Override diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupCapsAction.java b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupCapsAction.java index 5ae833455b6f4..b80cedf1b2789 100644 --- a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupCapsAction.java +++ b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupCapsAction.java @@ -24,7 +24,7 @@ public class RestGetRollupCapsAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_rollup/data/{id}", GET)); + return singletonList(new Route(GET, "/_rollup/data/{id}")); } @Override diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupIndexCapsAction.java b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupIndexCapsAction.java index 54671b329a1c7..8ef597c7499f7 100644 --- a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupIndexCapsAction.java +++ b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupIndexCapsAction.java @@ -26,7 +26,7 @@ public class RestGetRollupIndexCapsAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/{index}/_rollup/data", GET)); + return singletonList(new Route(GET, "/{index}/_rollup/data")); } @Override diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupJobsAction.java b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupJobsAction.java index c89cba0e98dec..8139e4fb4c251 100644 --- a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupJobsAction.java +++ b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupJobsAction.java @@ -24,7 +24,7 @@ public class RestGetRollupJobsAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_rollup/job/{id}", GET)); + return singletonList(new Route(GET, "/_rollup/job/{id}")); } @Override diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestPutRollupJobAction.java b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestPutRollupJobAction.java index 0ca31c0440897..94c6926c3babf 100644 --- a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestPutRollupJobAction.java +++ b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestPutRollupJobAction.java @@ -22,7 +22,7 @@ public class RestPutRollupJobAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_rollup/job/{id}", PUT)); + return singletonList(new Route(PUT, "/_rollup/job/{id}")); } @Override diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestRollupSearchAction.java b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestRollupSearchAction.java index a42e4c13609d9..87c965a2355c7 100644 --- a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestRollupSearchAction.java +++ b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestRollupSearchAction.java @@ -29,10 +29,10 @@ public class RestRollupSearchAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("_rollup_search", GET), - new Route("_rollup_search", POST), - new Route("{index}/_rollup_search", GET), - new Route("{index}/_rollup_search", POST))); + new Route(GET, "_rollup_search"), + new Route(POST, "_rollup_search"), + new Route(GET, "{index}/_rollup_search"), + new Route(POST, "{index}/_rollup_search"))); } @Override diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestStartRollupJobAction.java b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestStartRollupJobAction.java index 0b65188f97f2d..03a4f0104ab06 100644 --- a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestStartRollupJobAction.java +++ b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestStartRollupJobAction.java @@ -22,7 +22,7 @@ public class RestStartRollupJobAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_rollup/job/{id}/_start", POST)); + return singletonList(new Route(POST, "/_rollup/job/{id}/_start")); } @Override diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestStopRollupJobAction.java b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestStopRollupJobAction.java index 940c9b6ad5ae4..d18bf9fd53f17 100644 --- a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestStopRollupJobAction.java +++ b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestStopRollupJobAction.java @@ -23,7 +23,7 @@ public class RestStopRollupJobAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_rollup/job/{id}/_stop", POST)); + return singletonList(new Route(POST, "/_rollup/job/{id}/_stop")); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/RestDelegatePkiAuthenticationAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/RestDelegatePkiAuthenticationAction.java index 36e85676d2c31..13084ae145614 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/RestDelegatePkiAuthenticationAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/RestDelegatePkiAuthenticationAction.java @@ -47,7 +47,7 @@ public RestDelegatePkiAuthenticationAction(Settings settings, XPackLicenseState @Override public List handledRoutes() { - return singletonList(new Route("/_security/delegate_pki", POST)); + return singletonList(new Route(POST, "/_security/delegate_pki")); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestCreateApiKeyAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestCreateApiKeyAction.java index f4a75b61f4356..02feee31cf08d 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestCreateApiKeyAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestCreateApiKeyAction.java @@ -40,8 +40,8 @@ public RestCreateApiKeyAction(Settings settings, XPackLicenseState licenseState) @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_security/api_key", POST), - new Route("/_security/api_key", PUT))); + new Route(POST, "/_security/api_key"), + new Route(PUT, "/_security/api_key"))); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestGetApiKeyAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestGetApiKeyAction.java index 05f1fe0040ed2..6f094128904c6 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestGetApiKeyAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestGetApiKeyAction.java @@ -37,7 +37,7 @@ public RestGetApiKeyAction(Settings settings, XPackLicenseState licenseState) { @Override public List handledRoutes() { - return singletonList(new Route("/_security/api_key", GET)); + return singletonList(new Route(GET, "/_security/api_key")); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestInvalidateApiKeyAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestInvalidateApiKeyAction.java index 9ac2d17ff16ef..03daa16b7a180 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestInvalidateApiKeyAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestInvalidateApiKeyAction.java @@ -52,7 +52,7 @@ public RestInvalidateApiKeyAction(Settings settings, XPackLicenseState licenseSt @Override public List handledRoutes() { - return singletonList(new Route("/_security/api_key", DELETE)); + return singletonList(new Route(DELETE, "/_security/api_key")); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oidc/RestOpenIdConnectAuthenticateAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oidc/RestOpenIdConnectAuthenticateAction.java index c09b7bcfa326d..ea5dffbe3635c 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oidc/RestOpenIdConnectAuthenticateAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oidc/RestOpenIdConnectAuthenticateAction.java @@ -51,7 +51,7 @@ public RestOpenIdConnectAuthenticateAction(Settings settings, XPackLicenseState @Override public List handledRoutes() { - return singletonList(new Route("/_security/oidc/authenticate", POST)); + return singletonList(new Route(POST, "/_security/oidc/authenticate")); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oidc/RestOpenIdConnectLogoutAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oidc/RestOpenIdConnectLogoutAction.java index b590c6b4f95c1..1bcfbe750dd40 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oidc/RestOpenIdConnectLogoutAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oidc/RestOpenIdConnectLogoutAction.java @@ -47,7 +47,7 @@ public RestOpenIdConnectLogoutAction(Settings settings, XPackLicenseState licens @Override public List handledRoutes() { - return singletonList(new Route("/_security/oidc/logout", POST)); + return singletonList(new Route(POST, "/_security/oidc/logout")); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oidc/RestOpenIdConnectPrepareAuthenticationAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oidc/RestOpenIdConnectPrepareAuthenticationAction.java index 2cf4adcb209c8..ad7a6bb801f95 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oidc/RestOpenIdConnectPrepareAuthenticationAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oidc/RestOpenIdConnectPrepareAuthenticationAction.java @@ -52,7 +52,7 @@ public RestOpenIdConnectPrepareAuthenticationAction(Settings settings, XPackLice @Override public List handledRoutes() { - return singletonList(new Route("/_security/oidc/prepare", POST)); + return singletonList(new Route(POST, "/_security/oidc/prepare")); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestGetBuiltinPrivilegesAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestGetBuiltinPrivilegesAction.java index 83286bb329c79..0c754bba53285 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestGetBuiltinPrivilegesAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestGetBuiltinPrivilegesAction.java @@ -36,7 +36,7 @@ public RestGetBuiltinPrivilegesAction(Settings settings, XPackLicenseState licen @Override public List handledRoutes() { - return singletonList(new Route("/_security/privilege/_builtin", GET)); + return singletonList(new Route(GET, "/_security/privilege/_builtin")); } @Override diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlClearCursorAction.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlClearCursorAction.java index f0be77701ea27..0c78c12f6a1d6 100644 --- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlClearCursorAction.java +++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlClearCursorAction.java @@ -25,7 +25,7 @@ public class RestSqlClearCursorAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route(Protocol.CLEAR_CURSOR_REST_ENDPOINT, POST)); + return singletonList(new Route(POST, Protocol.CLEAR_CURSOR_REST_ENDPOINT)); } @Override diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlQueryAction.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlQueryAction.java index 0659d59c4e2a6..929a129455061 100644 --- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlQueryAction.java +++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlQueryAction.java @@ -36,8 +36,8 @@ public class RestSqlQueryAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route(Protocol.SQL_QUERY_REST_ENDPOINT, GET), - new Route(Protocol.SQL_QUERY_REST_ENDPOINT, POST))); + new Route(GET, Protocol.SQL_QUERY_REST_ENDPOINT), + new Route(POST, Protocol.SQL_QUERY_REST_ENDPOINT))); } @Override diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlStatsAction.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlStatsAction.java index 3324d3058a81a..d0a5977ef9c6f 100644 --- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlStatsAction.java +++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlStatsAction.java @@ -21,7 +21,7 @@ public class RestSqlStatsAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route(Protocol.SQL_STATS_REST_ENDPOINT, GET)); + return singletonList(new Route(GET, Protocol.SQL_STATS_REST_ENDPOINT)); } @Override diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlTranslateAction.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlTranslateAction.java index 540028c4351ac..72371f55b1637 100644 --- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlTranslateAction.java +++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlTranslateAction.java @@ -30,8 +30,8 @@ public class RestSqlTranslateAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route(Protocol.SQL_TRANSLATE_REST_ENDPOINT, GET), - new Route(Protocol.SQL_TRANSLATE_REST_ENDPOINT, POST))); + new Route(GET, Protocol.SQL_TRANSLATE_REST_ENDPOINT), + new Route(POST, Protocol.SQL_TRANSLATE_REST_ENDPOINT))); } @Override diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestDeleteTransformAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestDeleteTransformAction.java index f984fe071e5d4..6b3c990cec977 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestDeleteTransformAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestDeleteTransformAction.java @@ -22,7 +22,7 @@ public class RestDeleteTransformAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID, DELETE)); + return singletonList(new Route(DELETE, TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID)); } @Override diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestGetTransformAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestGetTransformAction.java index dca3534832cb1..2b7f41cdf6742 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestGetTransformAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestGetTransformAction.java @@ -26,8 +26,8 @@ public class RestGetTransformAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route(TransformField.REST_BASE_PATH_TRANSFORMS, GET), - new Route(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID, GET))); + new Route(GET, TransformField.REST_BASE_PATH_TRANSFORMS), + new Route(GET, TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID))); } @Override diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestGetTransformStatsAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestGetTransformStatsAction.java index 772b6d8600a82..dc493349a7145 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestGetTransformStatsAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestGetTransformStatsAction.java @@ -26,8 +26,8 @@ public class RestGetTransformStatsAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route(TransformField.REST_BASE_PATH_TRANSFORMS + "_stats", GET), - new Route(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID + "_stats", GET))); + new Route(GET, TransformField.REST_BASE_PATH_TRANSFORMS + "_stats"), + new Route(GET, TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID + "_stats"))); } @Override diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestPreviewTransformAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestPreviewTransformAction.java index 442d88865f89a..0a48d4c20bf72 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestPreviewTransformAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestPreviewTransformAction.java @@ -24,7 +24,7 @@ public class RestPreviewTransformAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route(TransformField.REST_BASE_PATH_TRANSFORMS + "_preview", POST)); + return singletonList(new Route(POST, TransformField.REST_BASE_PATH_TRANSFORMS + "_preview")); } @Override diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestPutTransformAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestPutTransformAction.java index 91d6c5f5160b4..923c53395c29a 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestPutTransformAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestPutTransformAction.java @@ -24,7 +24,7 @@ public class RestPutTransformAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID, PUT)); + return singletonList(new Route(PUT, TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID)); } @Override diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestStartTransformAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestStartTransformAction.java index de44180a83e8e..eff6c6a5b387b 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestStartTransformAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestStartTransformAction.java @@ -23,7 +23,7 @@ public class RestStartTransformAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID + "_start", POST)); + return singletonList(new Route(POST, TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID + "_start")); } @Override diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestStopTransformAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestStopTransformAction.java index edfbadd5f8697..9cbc259e8be20 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestStopTransformAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestStopTransformAction.java @@ -22,7 +22,7 @@ public class RestStopTransformAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID + "_stop", POST)); + return singletonList(new Route(POST, TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID + "_stop")); } @Override diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestUpdateTransformAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestUpdateTransformAction.java index cbfe87749eef5..e190e16db14a5 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestUpdateTransformAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestUpdateTransformAction.java @@ -24,7 +24,7 @@ public class RestUpdateTransformAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID + "_update", POST)); + return singletonList(new Route(POST, TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID + "_update")); } @Override diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestDeleteTransformActionDeprecated.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestDeleteTransformActionDeprecated.java index 0f60faa0a0799..ed4398f673c49 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestDeleteTransformActionDeprecated.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestDeleteTransformActionDeprecated.java @@ -35,8 +35,8 @@ public List handledRoutes() { @Override public List deprecatedRoutes() { - return singletonList(new DeprecatedRoute(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID_DEPRECATED, - DELETE, TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger)); + return singletonList(new DeprecatedRoute(DELETE, TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID_DEPRECATED, + TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger)); } @Override diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestGetTransformActionDeprecated.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestGetTransformActionDeprecated.java index 2a9ac6566d01b..eb9af9e0b8fc4 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestGetTransformActionDeprecated.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestGetTransformActionDeprecated.java @@ -39,10 +39,10 @@ public List handledRoutes() { @Override public List deprecatedRoutes() { return unmodifiableList(asList( - new DeprecatedRoute(TransformField.REST_BASE_PATH_TRANSFORMS_DEPRECATED, GET, - TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger), - new DeprecatedRoute(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID_DEPRECATED, GET, - TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger))); + new DeprecatedRoute(GET, TransformField.REST_BASE_PATH_TRANSFORMS_DEPRECATED, + TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger), + new DeprecatedRoute(GET, TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID_DEPRECATED, + TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger))); } @Override diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestGetTransformStatsActionDeprecated.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestGetTransformStatsActionDeprecated.java index 68b795c5754e4..d6e5442d19ef5 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestGetTransformStatsActionDeprecated.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestGetTransformStatsActionDeprecated.java @@ -39,10 +39,10 @@ public List handledRoutes() { @Override public List deprecatedRoutes() { return unmodifiableList(asList( - new DeprecatedRoute(TransformField.REST_BASE_PATH_TRANSFORMS_DEPRECATED + "_stats", GET, - TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger), - new DeprecatedRoute(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID_DEPRECATED + "_stats", GET, - TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger))); + new DeprecatedRoute(GET, TransformField.REST_BASE_PATH_TRANSFORMS_DEPRECATED + "_stats", + TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger), + new DeprecatedRoute(GET, TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID_DEPRECATED + "_stats", + TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger))); } @Override diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestPreviewTransformActionDeprecated.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestPreviewTransformActionDeprecated.java index c6691b59b58fa..a58b248f6777f 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestPreviewTransformActionDeprecated.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestPreviewTransformActionDeprecated.java @@ -37,8 +37,8 @@ public List handledRoutes() { @Override public List deprecatedRoutes() { - return singletonList(new DeprecatedRoute(TransformField.REST_BASE_PATH_TRANSFORMS_DEPRECATED + "_preview", - POST, TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger)); + return singletonList(new DeprecatedRoute(POST, TransformField.REST_BASE_PATH_TRANSFORMS_DEPRECATED + "_preview", + TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger)); } @Override diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestPutTransformActionDeprecated.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestPutTransformActionDeprecated.java index 9159c284d109f..2d24c06e17106 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestPutTransformActionDeprecated.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestPutTransformActionDeprecated.java @@ -37,8 +37,8 @@ public List handledRoutes() { @Override public List deprecatedRoutes() { - return singletonList(new DeprecatedRoute(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID_DEPRECATED, PUT, - TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger)); + return singletonList(new DeprecatedRoute(PUT, TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID_DEPRECATED, + TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger)); } @Override diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestStartTransformActionDeprecated.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestStartTransformActionDeprecated.java index c665c4ca991e4..9e5bbef2dc151 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestStartTransformActionDeprecated.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestStartTransformActionDeprecated.java @@ -36,8 +36,8 @@ public List handledRoutes() { @Override public List deprecatedRoutes() { - return singletonList(new DeprecatedRoute(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID_DEPRECATED + "_start", - POST, TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger)); + return singletonList(new DeprecatedRoute(POST, TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID_DEPRECATED + "_start", + TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger)); } @Override diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestStopTransformActionDeprecated.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestStopTransformActionDeprecated.java index 3335a41d00298..ad9b6d8509449 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestStopTransformActionDeprecated.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestStopTransformActionDeprecated.java @@ -35,8 +35,8 @@ public List handledRoutes() { @Override public List deprecatedRoutes() { - return singletonList(new DeprecatedRoute(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID_DEPRECATED + "_stop", POST, - TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger)); + return singletonList(new DeprecatedRoute(POST, TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID_DEPRECATED + "_stop", + TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger)); } @Override diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestUpdateTransformActionDeprecated.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestUpdateTransformActionDeprecated.java index 63a68f71a8ac5..7c30217bddf03 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestUpdateTransformActionDeprecated.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestUpdateTransformActionDeprecated.java @@ -37,8 +37,8 @@ public List handledRoutes() { @Override public List deprecatedRoutes() { - return singletonList(new DeprecatedRoute(TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID_DEPRECATED + "_update", - POST, TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger)); + return singletonList(new DeprecatedRoute(POST, TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID_DEPRECATED + "_update", + TransformMessages.REST_DEPRECATED_ENDPOINT, deprecationLogger)); } @Override diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestAckWatchAction.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestAckWatchAction.java index 04dba0903a860..fd294f1389077 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestAckWatchAction.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestAckWatchAction.java @@ -35,10 +35,10 @@ public class RestAckWatchAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_watcher/watch/{id}/_ack", POST), - new Route("/_watcher/watch/{id}/_ack", PUT), - new Route("/_watcher/watch/{id}/_ack/{actions}", POST), - new Route("/_watcher/watch/{id}/_ack/{actions}", PUT))); + new Route(POST, "/_watcher/watch/{id}/_ack"), + new Route(PUT, "/_watcher/watch/{id}/_ack"), + new Route(POST, "/_watcher/watch/{id}/_ack/{actions}"), + new Route(PUT, "/_watcher/watch/{id}/_ack/{actions}"))); } @Override diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestActivateWatchAction.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestActivateWatchAction.java index 066f82e24f4a4..161a3b519c183 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestActivateWatchAction.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestActivateWatchAction.java @@ -35,8 +35,8 @@ public class RestActivateWatchAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_watcher/watch/{id}/_activate", POST), - new Route("/_watcher/watch/{id}/_activate", PUT))); + new Route(POST, "/_watcher/watch/{id}/_activate"), + new Route(PUT, "/_watcher/watch/{id}/_activate"))); } @Override @@ -64,8 +64,8 @@ public static class DeactivateRestHandler extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_watcher/watch/{id}/_deactivate", POST), - new Route("/_watcher/watch/{id}/_deactivate", PUT))); + new Route(POST, "/_watcher/watch/{id}/_deactivate"), + new Route(PUT, "/_watcher/watch/{id}/_deactivate"))); } @Override diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestDeleteWatchAction.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestDeleteWatchAction.java index 47c2e9c01641c..171bad825cb84 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestDeleteWatchAction.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestDeleteWatchAction.java @@ -29,7 +29,7 @@ public class RestDeleteWatchAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_watcher/watch/{id}", DELETE)); + return singletonList(new Route(DELETE, "/_watcher/watch/{id}")); } @Override diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestExecuteWatchAction.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestExecuteWatchAction.java index df1bcf54d4431..ab56f87bc6100 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestExecuteWatchAction.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestExecuteWatchAction.java @@ -51,10 +51,10 @@ public class RestExecuteWatchAction extends BaseRestHandler implements RestReque @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_watcher/watch/{id}/_execute", POST), - new Route("/_watcher/watch/{id}/_execute", PUT), - new Route("/_watcher/watch/_execute", POST), - new Route("/_watcher/watch/_execute", PUT))); + new Route(POST, "/_watcher/watch/{id}/_execute"), + new Route(PUT, "/_watcher/watch/{id}/_execute"), + new Route(POST, "/_watcher/watch/_execute"), + new Route(PUT, "/_watcher/watch/_execute"))); } @Override diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestGetWatchAction.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestGetWatchAction.java index e4a287431b663..65fc95285c129 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestGetWatchAction.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestGetWatchAction.java @@ -29,7 +29,7 @@ public class RestGetWatchAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_watcher/watch/{id}", GET)); + return singletonList(new Route(GET, "/_watcher/watch/{id}")); } @Override diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestPutWatchAction.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestPutWatchAction.java index 068cf945a9253..39b599d513f69 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestPutWatchAction.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestPutWatchAction.java @@ -37,8 +37,8 @@ public class RestPutWatchAction extends BaseRestHandler implements RestRequestFi @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_watcher/watch/{id}", POST), - new Route("/_watcher/watch/{id}", PUT))); + new Route(POST, "/_watcher/watch/{id}"), + new Route(PUT, "/_watcher/watch/{id}"))); } @Override diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatchServiceAction.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatchServiceAction.java index c061feced4afe..c50ad989eab54 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatchServiceAction.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatchServiceAction.java @@ -22,7 +22,7 @@ public class RestWatchServiceAction extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_watcher/_start", POST)); + return singletonList(new Route(POST, "/_watcher/_start")); } @Override @@ -40,7 +40,7 @@ public static class StopRestHandler extends BaseRestHandler { @Override public List handledRoutes() { - return singletonList(new Route("/_watcher/_stop", POST)); + return singletonList(new Route(POST, "/_watcher/_stop")); } @Override diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatcherStatsAction.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatcherStatsAction.java index 641f4b36e371c..ba55822108c02 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatcherStatsAction.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatcherStatsAction.java @@ -32,8 +32,8 @@ public class RestWatcherStatsAction extends BaseRestHandler { @Override public List handledRoutes() { return unmodifiableList(asList( - new Route("/_watcher/stats", GET), - new Route("/_watcher/stats/{metric}", GET))); + new Route(GET, "/_watcher/stats"), + new Route(GET, "/_watcher/stats/{metric}"))); } @Override From 086a29595ffa8820814d925c64f97bc40b4fe741 Mon Sep 17 00:00:00 2001 From: jaymode Date: Fri, 7 Feb 2020 09:43:58 -0700 Subject: [PATCH 09/11] handledRoutes -> routes --- .../noop/action/bulk/RestNoopBulkAction.java | 2 +- .../action/search/RestNoopSearchAction.java | 2 +- .../ingest/common/GrokProcessorGetAction.java | 2 +- .../RestMultiSearchTemplateAction.java | 2 +- .../RestRenderSearchTemplateAction.java | 2 +- .../mustache/RestSearchTemplateAction.java | 2 +- .../painless/action/PainlessContextAction.java | 2 +- .../painless/action/PainlessExecuteAction.java | 2 +- .../index/rankeval/RestRankEvalAction.java | 2 +- .../index/reindex/RestDeleteByQueryAction.java | 2 +- .../index/reindex/RestReindexAction.java | 2 +- .../index/reindex/RestRethrottleAction.java | 2 +- .../index/reindex/RestUpdateByQueryAction.java | 2 +- .../example/resthandler/ExampleCatAction.java | 2 +- .../RestDieWithDignityAction.java | 2 +- .../http/TestDeprecationHeaderRestAction.java | 2 +- .../http/TestResponseHeaderRestAction.java | 2 +- .../elasticsearch/rest/BaseRestHandler.java | 2 +- .../org/elasticsearch/rest/RestController.java | 2 +- .../org/elasticsearch/rest/RestHandler.java | 2 +- .../action/RestFieldCapabilitiesAction.java | 2 +- .../rest/action/RestMainAction.java | 2 +- .../RestAddVotingConfigExclusionAction.java | 2 +- .../admin/cluster/RestCancelTasksAction.java | 2 +- .../cluster/RestCleanupRepositoryAction.java | 2 +- .../RestClearVotingConfigExclusionsAction.java | 2 +- .../RestClusterAllocationExplainAction.java | 2 +- .../cluster/RestClusterGetSettingsAction.java | 2 +- .../admin/cluster/RestClusterHealthAction.java | 2 +- .../cluster/RestClusterRerouteAction.java | 2 +- .../cluster/RestClusterSearchShardsAction.java | 2 +- .../admin/cluster/RestClusterStateAction.java | 2 +- .../admin/cluster/RestClusterStatsAction.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 +- .../cluster/RestGetScriptContextAction.java | 2 +- .../cluster/RestGetScriptLanguageAction.java | 2 +- .../admin/cluster/RestGetSnapshotsAction.java | 2 +- .../cluster/RestGetStoredScriptAction.java | 2 +- .../admin/cluster/RestGetTaskAction.java | 2 +- .../admin/cluster/RestListTasksAction.java | 2 +- .../cluster/RestNodesHotThreadsAction.java | 2 +- .../admin/cluster/RestNodesInfoAction.java | 2 +- .../admin/cluster/RestNodesStatsAction.java | 2 +- .../admin/cluster/RestNodesUsageAction.java | 2 +- .../cluster/RestPendingClusterTasksAction.java | 2 +- .../admin/cluster/RestPutRepositoryAction.java | 2 +- .../cluster/RestPutStoredScriptAction.java | 2 +- .../RestReloadSecureSettingsAction.java | 2 +- .../cluster/RestRemoteClusterInfoAction.java | 2 +- .../cluster/RestRestoreSnapshotAction.java | 2 +- .../cluster/RestSnapshotsStatusAction.java | 2 +- .../cluster/RestVerifyRepositoryAction.java | 2 +- .../admin/indices/RestAnalyzeAction.java | 2 +- .../indices/RestClearIndicesCacheAction.java | 2 +- .../admin/indices/RestCloseIndexAction.java | 2 +- .../admin/indices/RestCreateIndexAction.java | 2 +- .../admin/indices/RestDeleteIndexAction.java | 2 +- .../indices/RestDeleteIndexTemplateAction.java | 2 +- .../action/admin/indices/RestFlushAction.java | 2 +- .../admin/indices/RestForceMergeAction.java | 2 +- .../admin/indices/RestGetAliasesAction.java | 2 +- .../indices/RestGetFieldMappingAction.java | 2 +- .../indices/RestGetIndexTemplateAction.java | 2 +- .../admin/indices/RestGetIndicesAction.java | 2 +- .../admin/indices/RestGetMappingAction.java | 2 +- .../admin/indices/RestGetSettingsAction.java | 2 +- .../indices/RestIndexDeleteAliasesAction.java | 2 +- .../admin/indices/RestIndexPutAliasAction.java | 2 +- .../indices/RestIndicesAliasesAction.java | 2 +- .../indices/RestIndicesSegmentsAction.java | 2 +- .../indices/RestIndicesShardStoresAction.java | 2 +- .../admin/indices/RestIndicesStatsAction.java | 2 +- .../admin/indices/RestOpenIndexAction.java | 2 +- .../indices/RestPutIndexTemplateAction.java | 2 +- .../admin/indices/RestPutMappingAction.java | 2 +- .../admin/indices/RestRecoveryAction.java | 2 +- .../admin/indices/RestRefreshAction.java | 2 +- .../admin/indices/RestResizeHandler.java | 6 +++--- .../admin/indices/RestRolloverIndexAction.java | 2 +- .../admin/indices/RestSyncedFlushAction.java | 2 +- .../indices/RestUpdateSettingsAction.java | 2 +- .../indices/RestUpgradeActionDeprecated.java | 2 +- .../RestUpgradeStatusActionDeprecated.java | 2 +- .../admin/indices/RestValidateQueryAction.java | 2 +- .../rest/action/cat/RestAliasAction.java | 2 +- .../rest/action/cat/RestAllocationAction.java | 2 +- .../rest/action/cat/RestCatAction.java | 2 +- .../rest/action/cat/RestCatRecoveryAction.java | 2 +- .../rest/action/cat/RestCountAction.java | 2 +- .../rest/action/cat/RestFielddataAction.java | 2 +- .../rest/action/cat/RestHealthAction.java | 2 +- .../rest/action/cat/RestIndicesAction.java | 2 +- .../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/RestTasksAction.java | 2 +- .../rest/action/cat/RestTemplatesAction.java | 2 +- .../rest/action/cat/RestThreadPoolAction.java | 2 +- .../rest/action/document/RestBulkAction.java | 2 +- .../rest/action/document/RestDeleteAction.java | 2 +- .../rest/action/document/RestGetAction.java | 2 +- .../action/document/RestGetSourceAction.java | 2 +- .../rest/action/document/RestIndexAction.java | 6 +++--- .../action/document/RestMultiGetAction.java | 2 +- .../document/RestMultiTermVectorsAction.java | 2 +- .../action/document/RestTermVectorsAction.java | 2 +- .../rest/action/document/RestUpdateAction.java | 2 +- .../ingest/RestDeletePipelineAction.java | 2 +- .../action/ingest/RestGetPipelineAction.java | 2 +- .../action/ingest/RestPutPipelineAction.java | 2 +- .../ingest/RestSimulatePipelineAction.java | 2 +- .../action/search/RestClearScrollAction.java | 2 +- .../rest/action/search/RestCountAction.java | 2 +- .../rest/action/search/RestExplainAction.java | 2 +- .../action/search/RestMultiSearchAction.java | 2 +- .../rest/action/search/RestSearchAction.java | 2 +- .../action/search/RestSearchScrollAction.java | 2 +- .../action/ActionModuleTests.java | 6 +++--- .../rest/BaseRestHandlerTests.java | 18 +++++++++--------- .../elasticsearch/usage/UsageServiceTests.java | 2 +- .../RestGetAutoscalingDecisionHandler.java | 2 +- .../xpack/ccr/rest/RestCcrStatsAction.java | 2 +- .../RestDeleteAutoFollowPatternAction.java | 2 +- .../xpack/ccr/rest/RestFollowInfoAction.java | 2 +- .../xpack/ccr/rest/RestFollowStatsAction.java | 2 +- .../ccr/rest/RestForgetFollowerAction.java | 2 +- .../rest/RestGetAutoFollowPatternAction.java | 2 +- .../rest/RestPauseAutoFollowPatternAction.java | 2 +- .../xpack/ccr/rest/RestPauseFollowAction.java | 2 +- .../rest/RestPutAutoFollowPatternAction.java | 2 +- .../xpack/ccr/rest/RestPutFollowAction.java | 2 +- .../RestResumeAutoFollowPatternAction.java | 2 +- .../xpack/ccr/rest/RestResumeFollowAction.java | 2 +- .../xpack/ccr/rest/RestUnfollowAction.java | 2 +- .../license/RestDeleteLicenseAction.java | 2 +- .../license/RestGetBasicStatus.java | 2 +- .../license/RestGetLicenseAction.java | 2 +- .../license/RestGetTrialStatus.java | 2 +- .../license/RestPostStartBasicLicense.java | 2 +- .../license/RestPostStartTrialLicense.java | 2 +- .../license/RestPutLicenseAction.java | 2 +- .../rest/action/RestReloadAnalyzersAction.java | 2 +- .../core/rest/action/RestXPackInfoAction.java | 2 +- .../core/rest/action/RestXPackUsageAction.java | 2 +- .../ssl/rest/RestGetCertificateInfoAction.java | 2 +- .../deprecation/RestDeprecationInfoAction.java | 2 +- .../rest/RestDeleteEnrichPolicyAction.java | 2 +- .../enrich/rest/RestEnrichStatsAction.java | 2 +- .../rest/RestExecuteEnrichPolicyAction.java | 2 +- .../enrich/rest/RestGetEnrichPolicyAction.java | 2 +- .../enrich/rest/RestPutEnrichPolicyAction.java | 2 +- .../xpack/eql/plugin/RestEqlSearchAction.java | 2 +- .../rest/action/RestFreezeIndexAction.java | 2 +- .../graph/rest/action/RestGraphAction.java | 2 +- .../ilm/action/RestDeleteLifecycleAction.java | 2 +- .../ilm/action/RestExplainLifecycleAction.java | 2 +- .../ilm/action/RestGetLifecycleAction.java | 2 +- .../xpack/ilm/action/RestGetStatusAction.java | 2 +- .../xpack/ilm/action/RestMoveToStepAction.java | 2 +- .../ilm/action/RestPutLifecycleAction.java | 2 +- .../RestRemoveIndexLifecyclePolicyAction.java | 2 +- .../xpack/ilm/action/RestRetryAction.java | 2 +- .../xpack/ilm/action/RestStartILMAction.java | 2 +- .../xpack/ilm/action/RestStopAction.java | 2 +- .../RestDeleteSnapshotLifecycleAction.java | 2 +- .../RestExecuteSnapshotLifecycleAction.java | 2 +- .../RestExecuteSnapshotRetentionAction.java | 2 +- .../slm/action/RestGetSLMStatusAction.java | 2 +- .../action/RestGetSnapshotLifecycleAction.java | 2 +- .../RestGetSnapshotLifecycleStatsAction.java | 2 +- .../action/RestPutSnapshotLifecycleAction.java | 2 +- .../xpack/slm/action/RestStartSLMAction.java | 2 +- .../xpack/slm/action/RestStopSLMAction.java | 2 +- .../ml/rest/RestDeleteExpiredDataAction.java | 2 +- .../ml/rest/RestFindFileStructureAction.java | 2 +- .../xpack/ml/rest/RestMlInfoAction.java | 2 +- .../ml/rest/RestSetUpgradeModeAction.java | 2 +- .../calendar/RestDeleteCalendarAction.java | 2 +- .../RestDeleteCalendarEventAction.java | 2 +- .../calendar/RestDeleteCalendarJobAction.java | 2 +- .../calendar/RestGetCalendarEventsAction.java | 2 +- .../rest/calendar/RestGetCalendarsAction.java | 2 +- .../calendar/RestPostCalendarEventAction.java | 2 +- .../rest/calendar/RestPutCalendarAction.java | 2 +- .../calendar/RestPutCalendarJobAction.java | 2 +- .../ml/rest/cat/RestCatDatafeedsAction.java | 2 +- .../xpack/ml/rest/cat/RestCatJobsAction.java | 2 +- .../rest/cat/RestCatTrainedModelsAction.java | 2 +- .../datafeeds/RestDeleteDatafeedAction.java | 2 +- .../datafeeds/RestGetDatafeedStatsAction.java | 2 +- .../rest/datafeeds/RestGetDatafeedsAction.java | 2 +- .../datafeeds/RestPreviewDatafeedAction.java | 2 +- .../rest/datafeeds/RestPutDatafeedAction.java | 2 +- .../datafeeds/RestStartDatafeedAction.java | 2 +- .../rest/datafeeds/RestStopDatafeedAction.java | 2 +- .../datafeeds/RestUpdateDatafeedAction.java | 2 +- .../RestDeleteDataFrameAnalyticsAction.java | 2 +- .../dataframe/RestEvaluateDataFrameAction.java | 2 +- .../RestExplainDataFrameAnalyticsAction.java | 2 +- .../RestGetDataFrameAnalyticsAction.java | 2 +- .../RestGetDataFrameAnalyticsStatsAction.java | 2 +- .../RestPutDataFrameAnalyticsAction.java | 2 +- .../RestStartDataFrameAnalyticsAction.java | 2 +- .../RestStopDataFrameAnalyticsAction.java | 2 +- .../ml/rest/filter/RestDeleteFilterAction.java | 2 +- .../ml/rest/filter/RestGetFiltersAction.java | 2 +- .../ml/rest/filter/RestPutFilterAction.java | 2 +- .../ml/rest/filter/RestUpdateFilterAction.java | 2 +- .../RestDeleteTrainedModelAction.java | 2 +- .../inference/RestGetTrainedModelsAction.java | 2 +- .../RestGetTrainedModelsStatsAction.java | 2 +- .../inference/RestPutTrainedModelAction.java | 2 +- .../xpack/ml/rest/job/RestCloseJobAction.java | 2 +- .../ml/rest/job/RestDeleteForecastAction.java | 2 +- .../xpack/ml/rest/job/RestDeleteJobAction.java | 2 +- .../xpack/ml/rest/job/RestFlushJobAction.java | 2 +- .../ml/rest/job/RestForecastJobAction.java | 2 +- .../ml/rest/job/RestGetJobStatsAction.java | 2 +- .../xpack/ml/rest/job/RestGetJobsAction.java | 2 +- .../xpack/ml/rest/job/RestOpenJobAction.java | 2 +- .../xpack/ml/rest/job/RestPostDataAction.java | 2 +- .../ml/rest/job/RestPostJobUpdateAction.java | 2 +- .../xpack/ml/rest/job/RestPutJobAction.java | 2 +- .../RestDeleteModelSnapshotAction.java | 2 +- .../RestGetModelSnapshotsAction.java | 2 +- .../RestRevertModelSnapshotAction.java | 2 +- .../RestUpdateModelSnapshotAction.java | 2 +- .../ml/rest/results/RestGetBucketsAction.java | 2 +- .../rest/results/RestGetCategoriesAction.java | 2 +- .../rest/results/RestGetInfluencersAction.java | 2 +- .../results/RestGetOverallBucketsAction.java | 2 +- .../ml/rest/results/RestGetRecordsAction.java | 2 +- .../validate/RestValidateDetectorAction.java | 2 +- .../validate/RestValidateJobConfigAction.java | 2 +- .../rest/action/RestMonitoringBulkAction.java | 2 +- .../rollup/rest/RestDeleteRollupJobAction.java | 2 +- .../rollup/rest/RestGetRollupCapsAction.java | 2 +- .../rest/RestGetRollupIndexCapsAction.java | 2 +- .../rollup/rest/RestGetRollupJobsAction.java | 2 +- .../rollup/rest/RestPutRollupJobAction.java | 2 +- .../rollup/rest/RestRollupSearchAction.java | 2 +- .../rollup/rest/RestStartRollupJobAction.java | 2 +- .../rollup/rest/RestStopRollupJobAction.java | 2 +- .../security/rest/SecurityRestFilter.java | 4 ++-- .../rest/action/RestAuthenticateAction.java | 2 +- .../RestDelegatePkiAuthenticationAction.java | 2 +- .../action/apikey/RestCreateApiKeyAction.java | 2 +- .../action/apikey/RestGetApiKeyAction.java | 2 +- .../apikey/RestInvalidateApiKeyAction.java | 2 +- .../rest/action/oauth2/RestGetTokenAction.java | 2 +- .../oauth2/RestInvalidateTokenAction.java | 2 +- .../RestOpenIdConnectAuthenticateAction.java | 2 +- .../oidc/RestOpenIdConnectLogoutAction.java | 2 +- ...enIdConnectPrepareAuthenticationAction.java | 2 +- .../privilege/RestDeletePrivilegesAction.java | 2 +- .../RestGetBuiltinPrivilegesAction.java | 2 +- .../privilege/RestGetPrivilegesAction.java | 2 +- .../privilege/RestPutPrivilegesAction.java | 2 +- .../realm/RestClearRealmCacheAction.java | 2 +- .../action/role/RestClearRolesCacheAction.java | 2 +- .../rest/action/role/RestDeleteRoleAction.java | 2 +- .../rest/action/role/RestGetRolesAction.java | 2 +- .../rest/action/role/RestPutRoleAction.java | 2 +- .../RestDeleteRoleMappingAction.java | 2 +- .../rolemapping/RestGetRoleMappingsAction.java | 2 +- .../rolemapping/RestPutRoleMappingAction.java | 2 +- .../saml/RestSamlAuthenticateAction.java | 2 +- .../saml/RestSamlInvalidateSessionAction.java | 2 +- .../rest/action/saml/RestSamlLogoutAction.java | 2 +- .../RestSamlPrepareAuthenticationAction.java | 2 +- .../action/user/RestChangePasswordAction.java | 2 +- .../rest/action/user/RestDeleteUserAction.java | 2 +- .../user/RestGetUserPrivilegesAction.java | 2 +- .../rest/action/user/RestGetUsersAction.java | 2 +- .../action/user/RestHasPrivilegesAction.java | 2 +- .../rest/action/user/RestPutUserAction.java | 2 +- .../rest/action/user/RestSetEnabledAction.java | 2 +- .../action/SecurityBaseRestHandlerTests.java | 2 +- .../action/saml/SamlBaseRestHandlerTests.java | 2 +- .../sql/plugin/RestSqlClearCursorAction.java | 2 +- .../xpack/sql/plugin/RestSqlQueryAction.java | 2 +- .../xpack/sql/plugin/RestSqlStatsAction.java | 2 +- .../sql/plugin/RestSqlTranslateAction.java | 2 +- .../rest/action/RestDeleteTransformAction.java | 2 +- .../rest/action/RestGetTransformAction.java | 2 +- .../action/RestGetTransformStatsAction.java | 2 +- .../action/RestPreviewTransformAction.java | 2 +- .../rest/action/RestPutTransformAction.java | 2 +- .../rest/action/RestStartTransformAction.java | 2 +- .../rest/action/RestStopTransformAction.java | 2 +- .../rest/action/RestUpdateTransformAction.java | 2 +- .../RestDeleteTransformActionDeprecated.java | 2 +- .../RestGetTransformActionDeprecated.java | 2 +- .../RestGetTransformStatsActionDeprecated.java | 2 +- .../RestPreviewTransformActionDeprecated.java | 2 +- .../RestPutTransformActionDeprecated.java | 2 +- .../RestStartTransformActionDeprecated.java | 2 +- .../RestStopTransformActionDeprecated.java | 2 +- .../RestUpdateTransformActionDeprecated.java | 2 +- .../rest/action/RestAckWatchAction.java | 2 +- .../rest/action/RestActivateWatchAction.java | 4 ++-- .../rest/action/RestDeleteWatchAction.java | 2 +- .../rest/action/RestExecuteWatchAction.java | 2 +- .../rest/action/RestGetWatchAction.java | 2 +- .../rest/action/RestPutWatchAction.java | 2 +- .../rest/action/RestWatchServiceAction.java | 4 ++-- .../rest/action/RestWatcherStatsAction.java | 2 +- 318 files changed, 335 insertions(+), 335 deletions(-) diff --git a/client/client-benchmark-noop-api-plugin/src/main/java/org/elasticsearch/plugin/noop/action/bulk/RestNoopBulkAction.java b/client/client-benchmark-noop-api-plugin/src/main/java/org/elasticsearch/plugin/noop/action/bulk/RestNoopBulkAction.java index af94cb97c70c8..389656ed07754 100644 --- a/client/client-benchmark-noop-api-plugin/src/main/java/org/elasticsearch/plugin/noop/action/bulk/RestNoopBulkAction.java +++ b/client/client-benchmark-noop-api-plugin/src/main/java/org/elasticsearch/plugin/noop/action/bulk/RestNoopBulkAction.java @@ -48,7 +48,7 @@ public class RestNoopBulkAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(POST, "/_noop_bulk"), new Route(PUT, "/_noop_bulk"), diff --git a/client/client-benchmark-noop-api-plugin/src/main/java/org/elasticsearch/plugin/noop/action/search/RestNoopSearchAction.java b/client/client-benchmark-noop-api-plugin/src/main/java/org/elasticsearch/plugin/noop/action/search/RestNoopSearchAction.java index a9b0fe2d84cb4..cfc58b3aac946 100644 --- a/client/client-benchmark-noop-api-plugin/src/main/java/org/elasticsearch/plugin/noop/action/search/RestNoopSearchAction.java +++ b/client/client-benchmark-noop-api-plugin/src/main/java/org/elasticsearch/plugin/noop/action/search/RestNoopSearchAction.java @@ -34,7 +34,7 @@ public class RestNoopSearchAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_noop_search"), new Route(POST, "/_noop_search"), diff --git a/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/GrokProcessorGetAction.java b/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/GrokProcessorGetAction.java index ee277addd20ec..25ae529a2b2bd 100644 --- a/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/GrokProcessorGetAction.java +++ b/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/GrokProcessorGetAction.java @@ -119,7 +119,7 @@ protected void doExecute(Task task, Request request, ActionListener li public static class RestAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(GET, "/_ingest/processor/grok")); } diff --git a/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestMultiSearchTemplateAction.java b/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestMultiSearchTemplateAction.java index 72403afc423e2..70e41f8596d05 100644 --- a/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestMultiSearchTemplateAction.java +++ b/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestMultiSearchTemplateAction.java @@ -57,7 +57,7 @@ public RestMultiSearchTemplateAction(Settings settings) { } @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_msearch/template"), new Route(POST, "/_msearch/template"), diff --git a/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestRenderSearchTemplateAction.java b/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestRenderSearchTemplateAction.java index d6635c060993a..320c6c582c8fb 100644 --- a/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestRenderSearchTemplateAction.java +++ b/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestRenderSearchTemplateAction.java @@ -37,7 +37,7 @@ public class RestRenderSearchTemplateAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_render/template"), new Route(POST, "/_render/template"), diff --git a/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestSearchTemplateAction.java b/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestSearchTemplateAction.java index 7baf7c8cca4c2..70a87f3d20c27 100644 --- a/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestSearchTemplateAction.java +++ b/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestSearchTemplateAction.java @@ -49,7 +49,7 @@ public class RestSearchTemplateAction extends BaseRestHandler { } @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_search/template"), new Route(POST, "/_search/template"), diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/action/PainlessContextAction.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/action/PainlessContextAction.java index 2963d68a7cf98..d670d9e35aaab 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/action/PainlessContextAction.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/action/PainlessContextAction.java @@ -195,7 +195,7 @@ protected void doExecute(Task task, Request request, ActionListener li public static class RestAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(GET, "/_scripts/painless/_context")); } diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/action/PainlessExecuteAction.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/action/PainlessExecuteAction.java index 048067e90580b..73847385d5eff 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/action/PainlessExecuteAction.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/action/PainlessExecuteAction.java @@ -567,7 +567,7 @@ private static Response prepareRamIndex(Request request, public static class RestAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_scripts/painless/_execute"), new Route(POST, "/_scripts/painless/_execute"))); diff --git a/modules/rank-eval/src/main/java/org/elasticsearch/index/rankeval/RestRankEvalAction.java b/modules/rank-eval/src/main/java/org/elasticsearch/index/rankeval/RestRankEvalAction.java index 6874935c97a8e..fc1f9f9f53cdb 100644 --- a/modules/rank-eval/src/main/java/org/elasticsearch/index/rankeval/RestRankEvalAction.java +++ b/modules/rank-eval/src/main/java/org/elasticsearch/index/rankeval/RestRankEvalAction.java @@ -93,7 +93,7 @@ public class RestRankEvalAction extends BaseRestHandler { public static String ENDPOINT = "_rank_eval"; @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/" + ENDPOINT), new Route(POST, "/" + ENDPOINT), diff --git a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestDeleteByQueryAction.java b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestDeleteByQueryAction.java index 0f4983d570e6a..94d6fc0b3937a 100644 --- a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestDeleteByQueryAction.java +++ b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestDeleteByQueryAction.java @@ -38,7 +38,7 @@ public RestDeleteByQueryAction() { } @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(POST, "/{index}/_delete_by_query")); } diff --git a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestReindexAction.java b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestReindexAction.java index bb5d2e5def5b1..1677fbd7c6127 100644 --- a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestReindexAction.java +++ b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestReindexAction.java @@ -40,7 +40,7 @@ public RestReindexAction() { } @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(POST, "/_reindex")); } diff --git a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestRethrottleAction.java b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestRethrottleAction.java index dedb57db26961..a89546efc27de 100644 --- a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestRethrottleAction.java +++ b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestRethrottleAction.java @@ -41,7 +41,7 @@ public RestRethrottleAction(Supplier nodesInCluster) { } @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(POST, "/_update_by_query/{taskId}/_rethrottle"), new Route(POST, "/_delete_by_query/{taskId}/_rethrottle"), diff --git a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestUpdateByQueryAction.java b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestUpdateByQueryAction.java index f6bcfac9b10ea..0af069997d597 100644 --- a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestUpdateByQueryAction.java +++ b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestUpdateByQueryAction.java @@ -45,7 +45,7 @@ public RestUpdateByQueryAction() { } @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(POST, "/{index}/_update_by_query")); } diff --git a/plugins/examples/rest-handler/src/main/java/org/elasticsearch/example/resthandler/ExampleCatAction.java b/plugins/examples/rest-handler/src/main/java/org/elasticsearch/example/resthandler/ExampleCatAction.java index 7110cac467a8f..1a8e2485529f0 100644 --- a/plugins/examples/rest-handler/src/main/java/org/elasticsearch/example/resthandler/ExampleCatAction.java +++ b/plugins/examples/rest-handler/src/main/java/org/elasticsearch/example/resthandler/ExampleCatAction.java @@ -38,7 +38,7 @@ public class ExampleCatAction extends AbstractCatAction { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_cat/example"), new Route(POST, "/_cat/example"))); diff --git a/qa/die-with-dignity/src/main/java/org/elasticsearch/RestDieWithDignityAction.java b/qa/die-with-dignity/src/main/java/org/elasticsearch/RestDieWithDignityAction.java index a15251b58f512..190a6929b1c31 100644 --- a/qa/die-with-dignity/src/main/java/org/elasticsearch/RestDieWithDignityAction.java +++ b/qa/die-with-dignity/src/main/java/org/elasticsearch/RestDieWithDignityAction.java @@ -33,7 +33,7 @@ public class RestDieWithDignityAction extends BaseRestHandler { RestDieWithDignityAction() {} @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(GET, "/_die_with_dignity")); } diff --git a/qa/smoke-test-http/src/test/java/org/elasticsearch/http/TestDeprecationHeaderRestAction.java b/qa/smoke-test-http/src/test/java/org/elasticsearch/http/TestDeprecationHeaderRestAction.java index 08f7d68e91f41..29ea6af514e4e 100644 --- a/qa/smoke-test-http/src/test/java/org/elasticsearch/http/TestDeprecationHeaderRestAction.java +++ b/qa/smoke-test-http/src/test/java/org/elasticsearch/http/TestDeprecationHeaderRestAction.java @@ -85,7 +85,7 @@ public String getName() { } @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/qa/smoke-test-http/src/test/java/org/elasticsearch/http/TestResponseHeaderRestAction.java b/qa/smoke-test-http/src/test/java/org/elasticsearch/http/TestResponseHeaderRestAction.java index 62f57178ef177..d69beb337438b 100644 --- a/qa/smoke-test-http/src/test/java/org/elasticsearch/http/TestResponseHeaderRestAction.java +++ b/qa/smoke-test-http/src/test/java/org/elasticsearch/http/TestResponseHeaderRestAction.java @@ -33,7 +33,7 @@ public class TestResponseHeaderRestAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(GET, "/_protected")); } diff --git a/server/src/main/java/org/elasticsearch/rest/BaseRestHandler.java b/server/src/main/java/org/elasticsearch/rest/BaseRestHandler.java index 9eb0b98508852..f2fd12bfa79c2 100644 --- a/server/src/main/java/org/elasticsearch/rest/BaseRestHandler.java +++ b/server/src/main/java/org/elasticsearch/rest/BaseRestHandler.java @@ -72,7 +72,7 @@ public final long getUsageCount() { * {@inheritDoc} */ @Override - public abstract List handledRoutes(); + public abstract List routes(); @Override public final void handleRequest(RestRequest request, RestChannel channel, NodeClient client) throws Exception { diff --git a/server/src/main/java/org/elasticsearch/rest/RestController.java b/server/src/main/java/org/elasticsearch/rest/RestController.java index 4c9298dc52d69..6a16007465c53 100644 --- a/server/src/main/java/org/elasticsearch/rest/RestController.java +++ b/server/src/main/java/org/elasticsearch/rest/RestController.java @@ -160,7 +160,7 @@ protected void registerHandler(RestRequest.Method method, String path, RestHandl * and {@code path} combinations. */ public void registerHandler(final RestHandler restHandler) { - restHandler.handledRoutes().forEach(route -> registerHandler(route.getMethod(), route.getPath(), restHandler)); + restHandler.routes().forEach(route -> registerHandler(route.getMethod(), route.getPath(), restHandler)); restHandler.deprecatedRoutes().forEach(route -> registerAsDeprecatedHandler(route.getMethod(), route.getPath(), restHandler, route.getDeprecationMessage(), route.getLogger())); restHandler.replacedRoutes().forEach(route -> registerWithDeprecatedHandler(route.getMethod(), route.getPath(), diff --git a/server/src/main/java/org/elasticsearch/rest/RestHandler.java b/server/src/main/java/org/elasticsearch/rest/RestHandler.java index bd37cd4aa4d94..ab7b468f7576d 100644 --- a/server/src/main/java/org/elasticsearch/rest/RestHandler.java +++ b/server/src/main/java/org/elasticsearch/rest/RestHandler.java @@ -68,7 +68,7 @@ default boolean allowsUnsafeBuffers() { /** * The list of {@link Route}s that this RestHandler is responsible for handling. */ - default List handledRoutes() { + default List routes() { return Collections.emptyList(); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/RestFieldCapabilitiesAction.java b/server/src/main/java/org/elasticsearch/rest/action/RestFieldCapabilitiesAction.java index 3355435d567a7..6d868dd0d1bce 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/RestFieldCapabilitiesAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/RestFieldCapabilitiesAction.java @@ -37,7 +37,7 @@ public class RestFieldCapabilitiesAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_field_caps"), new Route(POST, "/_field_caps"), diff --git a/server/src/main/java/org/elasticsearch/rest/action/RestMainAction.java b/server/src/main/java/org/elasticsearch/rest/action/RestMainAction.java index 025a03b16486f..f5a433cd57e73 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/RestMainAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/RestMainAction.java @@ -41,7 +41,7 @@ public class RestMainAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/"), new Route(HEAD, "/"))); diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestAddVotingConfigExclusionAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestAddVotingConfigExclusionAction.java index 2d257cca71c03..4384d0d9dadff 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestAddVotingConfigExclusionAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestAddVotingConfigExclusionAction.java @@ -44,7 +44,7 @@ public String getName() { } @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(POST, "/_cluster/voting_config_exclusions/{node_name}")); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCancelTasksAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCancelTasksAction.java index 820806bc5b47b..99321627cf7fb 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCancelTasksAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCancelTasksAction.java @@ -50,7 +50,7 @@ public String getName() { } @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList(new Route(POST, "/_tasks/_cancel"), new Route(POST, "/_tasks/{task_id}/_cancel"))); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCleanupRepositoryAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCleanupRepositoryAction.java index 7ac61a69820da..3e9d8e46022a2 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCleanupRepositoryAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCleanupRepositoryAction.java @@ -38,7 +38,7 @@ public class RestCleanupRepositoryAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(POST, "/_snapshot/{repository}/_cleanup")); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClearVotingConfigExclusionsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClearVotingConfigExclusionsAction.java index 7012284287266..67c6a4e5d988c 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClearVotingConfigExclusionsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClearVotingConfigExclusionsAction.java @@ -35,7 +35,7 @@ public class RestClearVotingConfigExclusionsAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(DELETE, "/_cluster/voting_config_exclusions")); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterAllocationExplainAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterAllocationExplainAction.java index 8391d8279cb5c..d8a3b81d8c2fe 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterAllocationExplainAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterAllocationExplainAction.java @@ -46,7 +46,7 @@ public class RestClusterAllocationExplainAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_cluster/allocation/explain"), new Route(POST, "/_cluster/allocation/explain"))); diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterGetSettingsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterGetSettingsAction.java index 157de85ff57a9..03064337b3930 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterGetSettingsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterGetSettingsAction.java @@ -57,7 +57,7 @@ public RestClusterGetSettingsAction(Settings settings, ClusterSettings clusterSe } @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(GET, "/_cluster/settings")); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterHealthAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterHealthAction.java index acb8248eb44d2..99ac7d440815c 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterHealthAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterHealthAction.java @@ -44,7 +44,7 @@ public class RestClusterHealthAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList(new Route(GET, "/_cluster/health"), new Route(GET, "/_cluster/health/{index}"))); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterRerouteAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterRerouteAction.java index 6a2679e1f5bf4..c5a60cf7b6b55 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterRerouteAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterRerouteAction.java @@ -62,7 +62,7 @@ public RestClusterRerouteAction(SettingsFilter settingsFilter) { } @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(POST, "/_cluster/reroute")); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterSearchShardsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterSearchShardsAction.java index 0cb32cb0b6219..3660450457cb8 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterSearchShardsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterSearchShardsAction.java @@ -39,7 +39,7 @@ public class RestClusterSearchShardsAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_search_shards"), new Route(POST, "/_search_shards"), diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterStateAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterStateAction.java index b938bc1e9fc2a..1c68d2d5147d3 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterStateAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterStateAction.java @@ -61,7 +61,7 @@ public String getName() { } @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_cluster/state"), new Route(GET, "/_cluster/state/{metric}"), diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterStatsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterStatsAction.java index e3bee7ade71b9..9edaa4b2f1be1 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterStatsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterStatsAction.java @@ -35,7 +35,7 @@ public class RestClusterStatsAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_cluster/stats"), new Route(GET, "/_cluster/stats/nodes/{nodeId}"))); diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterUpdateSettingsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterUpdateSettingsAction.java index 0556e68cd2cef..3558da8ee0819 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterUpdateSettingsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterUpdateSettingsAction.java @@ -42,7 +42,7 @@ public class RestClusterUpdateSettingsAction extends BaseRestHandler { private static final String TRANSIENT = "transient"; @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(PUT, "/_cluster/settings")); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCreateSnapshotAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCreateSnapshotAction.java index db7cae7b063e8..2f56b0b10e2ec 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCreateSnapshotAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCreateSnapshotAction.java @@ -40,7 +40,7 @@ public class RestCreateSnapshotAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(PUT, "/_snapshot/{repository}/{snapshot}"), new Route(POST, "/_snapshot/{repository}/{snapshot}"))); diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteRepositoryAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteRepositoryAction.java index 5436bf1035872..95f635d1728a2 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteRepositoryAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteRepositoryAction.java @@ -38,7 +38,7 @@ public class RestDeleteRepositoryAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(DELETE, "/_snapshot/{repository}")); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteSnapshotAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteSnapshotAction.java index 68951288d575f..f74fc73c1f326 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteSnapshotAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteSnapshotAction.java @@ -38,7 +38,7 @@ public class RestDeleteSnapshotAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(DELETE, "/_snapshot/{repository}/{snapshot}")); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteStoredScriptAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteStoredScriptAction.java index 51da84f865a39..efd18f6415530 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteStoredScriptAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteStoredScriptAction.java @@ -33,7 +33,7 @@ public class RestDeleteStoredScriptAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(DELETE, "/_scripts/{id}")); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetRepositoriesAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetRepositoriesAction.java index 1503a0bd60bcc..572cb96cc0960 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetRepositoriesAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetRepositoriesAction.java @@ -54,7 +54,7 @@ public String getName() { } @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_snapshot"), new Route(GET, "/_snapshot/{repository}"))); diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetScriptContextAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetScriptContextAction.java index c8c048496d835..e7c0b65e3b587 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetScriptContextAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetScriptContextAction.java @@ -35,7 +35,7 @@ public class RestGetScriptContextAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(GET, "/_script_context")); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetScriptLanguageAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetScriptLanguageAction.java index 9e54adf566403..d40bbeb0b8df7 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetScriptLanguageAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetScriptLanguageAction.java @@ -35,7 +35,7 @@ public class RestGetScriptLanguageAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(GET, "/_script_language")); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetSnapshotsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetSnapshotsAction.java index 97c39b7f22132..1c90bb79f32fd 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetSnapshotsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetSnapshotsAction.java @@ -39,7 +39,7 @@ public class RestGetSnapshotsAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(GET, "/_snapshot/{repository}/{snapshot}")); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetStoredScriptAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetStoredScriptAction.java index 4862dcab0a07e..48407c7b5d534 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetStoredScriptAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetStoredScriptAction.java @@ -33,7 +33,7 @@ public class RestGetStoredScriptAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(GET, "/_scripts/{id}")); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetTaskAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetTaskAction.java index d540897d7f413..6eded15a253bf 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetTaskAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetTaskAction.java @@ -36,7 +36,7 @@ public class RestGetTaskAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(GET, "/_tasks/{task_id}")); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestListTasksAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestListTasksAction.java index ba425eb0cfd30..b6c9fad9fdef2 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestListTasksAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestListTasksAction.java @@ -54,7 +54,7 @@ public RestListTasksAction(Supplier nodesInCluster) { } @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(GET, "/_tasks")); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesHotThreadsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesHotThreadsAction.java index aac11df51e565..5aeefa934d02e 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesHotThreadsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesHotThreadsAction.java @@ -43,7 +43,7 @@ public class RestNodesHotThreadsAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_cluster/nodes/hotthreads"), new Route(GET, "/_cluster/nodes/hot_threads"), diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesInfoAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesInfoAction.java index 87fd7ddb2cd95..4b42516ef06b9 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesInfoAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesInfoAction.java @@ -57,7 +57,7 @@ public RestNodesInfoAction(SettingsFilter settingsFilter) { } @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_nodes"), // this endpoint is used for metrics, not for node IDs, like /_nodes/fs diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsAction.java index 032a288b61227..6eb834c3234cb 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsAction.java @@ -46,7 +46,7 @@ public class RestNodesStatsAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_nodes/stats"), new Route(GET, "/_nodes/{nodeId}/stats"), diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesUsageAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesUsageAction.java index c5aa7fcf0bebe..0e8b6370f9a12 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesUsageAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesUsageAction.java @@ -44,7 +44,7 @@ public class RestNodesUsageAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_nodes/usage"), new Route(GET, "/_nodes/{nodeId}/usage"), diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPendingClusterTasksAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPendingClusterTasksAction.java index c6cb9b3791b8a..05265f77f85a9 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPendingClusterTasksAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPendingClusterTasksAction.java @@ -34,7 +34,7 @@ public class RestPendingClusterTasksAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(GET, "/_cluster/pending_tasks")); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPutRepositoryAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPutRepositoryAction.java index 6545382b02ca3..f76d97e0296bb 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPutRepositoryAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPutRepositoryAction.java @@ -41,7 +41,7 @@ public class RestPutRepositoryAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(POST, "/_snapshot/{repository}"), new Route(PUT, "/_snapshot/{repository}"))); diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPutStoredScriptAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPutStoredScriptAction.java index f6da6ebbf34ed..499fd1b91f290 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPutStoredScriptAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPutStoredScriptAction.java @@ -38,7 +38,7 @@ public class RestPutStoredScriptAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(POST, "/_scripts/{id}"), new Route(PUT, "/_scripts/{id}"), diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestReloadSecureSettingsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestReloadSecureSettingsAction.java index 45b6271b621ce..209e0ef7d3357 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestReloadSecureSettingsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestReloadSecureSettingsAction.java @@ -59,7 +59,7 @@ public String getName() { } @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(POST, "/_nodes/reload_secure_settings"), new Route(POST, "/_nodes/{nodeId}/reload_secure_settings"))); diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestRemoteClusterInfoAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestRemoteClusterInfoAction.java index 15d69560df0f1..e12d930c5bf28 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestRemoteClusterInfoAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestRemoteClusterInfoAction.java @@ -34,7 +34,7 @@ public final class RestRemoteClusterInfoAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(GET, "_remote/info")); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestRestoreSnapshotAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestRestoreSnapshotAction.java index 985ffbe575590..d94c2e0285cd7 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestRestoreSnapshotAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestRestoreSnapshotAction.java @@ -38,7 +38,7 @@ public class RestRestoreSnapshotAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(POST, "/_snapshot/{repository}/{snapshot}/_restore")); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestSnapshotsStatusAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestSnapshotsStatusAction.java index dacdd07ac833d..19328f2eff2c0 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestSnapshotsStatusAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestSnapshotsStatusAction.java @@ -40,7 +40,7 @@ public class RestSnapshotsStatusAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_snapshot/{repository}/{snapshot}/_status"), new Route(GET, "/_snapshot/{repository}/_status"), diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestVerifyRepositoryAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestVerifyRepositoryAction.java index 7a38348c72db4..ad796897c8a87 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestVerifyRepositoryAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestVerifyRepositoryAction.java @@ -35,7 +35,7 @@ public class RestVerifyRepositoryAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(POST, "/_snapshot/{repository}/_verify")); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestAnalyzeAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestAnalyzeAction.java index ecae40d4e7842..15d34a91d9d17 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestAnalyzeAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestAnalyzeAction.java @@ -49,7 +49,7 @@ public static class Fields { } @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_analyze"), new Route(POST, "/_analyze"), diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestClearIndicesCacheAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestClearIndicesCacheAction.java index 97d0c13b39b8d..fd6979c92e29c 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestClearIndicesCacheAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestClearIndicesCacheAction.java @@ -37,7 +37,7 @@ public class RestClearIndicesCacheAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(POST, "/_cache/clear"), new Route(POST, "/{index}/_cache/clear"))); diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCloseIndexAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCloseIndexAction.java index e18c94cce7e43..5d3a186b8cb4b 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCloseIndexAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCloseIndexAction.java @@ -38,7 +38,7 @@ public class RestCloseIndexAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(POST, "/_close"), new Route(POST, "/{index}/_close"))); diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCreateIndexAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCreateIndexAction.java index c677d985f7c40..59156c70502ef 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCreateIndexAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCreateIndexAction.java @@ -41,7 +41,7 @@ public class RestCreateIndexAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(PUT, "/{index}")); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestDeleteIndexAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestDeleteIndexAction.java index 966f22190871c..a82370e89af82 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestDeleteIndexAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestDeleteIndexAction.java @@ -37,7 +37,7 @@ public class RestDeleteIndexAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(DELETE, "/"), new Route(DELETE, "/{index}"))); diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestDeleteIndexTemplateAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestDeleteIndexTemplateAction.java index c1d08d6de6381..a92bee023452a 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestDeleteIndexTemplateAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestDeleteIndexTemplateAction.java @@ -33,7 +33,7 @@ public class RestDeleteIndexTemplateAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(DELETE, "/_template/{name}")); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestFlushAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestFlushAction.java index 84677e60a0147..d22dcb91d1a94 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestFlushAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestFlushAction.java @@ -38,7 +38,7 @@ public class RestFlushAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_flush"), new Route(POST, "/_flush"), diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestForceMergeAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestForceMergeAction.java index 797d2d6f27da5..9cba54ed77245 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestForceMergeAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestForceMergeAction.java @@ -37,7 +37,7 @@ public class RestForceMergeAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(POST, "/_forcemerge"), new Route(POST, "/{index}/_forcemerge"))); diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetAliasesAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetAliasesAction.java index d9368aaf086fe..f05554322aa7c 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetAliasesAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetAliasesAction.java @@ -57,7 +57,7 @@ public class RestGetAliasesAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_alias"), new Route(GET, "/_aliases"), diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetFieldMappingAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetFieldMappingAction.java index 8dbfc6ece48a5..807ff220ff8e1 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetFieldMappingAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetFieldMappingAction.java @@ -46,7 +46,7 @@ public class RestGetFieldMappingAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_mapping/field/{fields}"), new Route(GET, "/{index}/_mapping/field/{fields}"))); diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndexTemplateAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndexTemplateAction.java index addfc75b00412..767c5fa3e923d 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndexTemplateAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndexTemplateAction.java @@ -46,7 +46,7 @@ public class RestGetIndexTemplateAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_template"), new Route(GET, "/_template/{name}"), diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndicesAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndicesAction.java index f6579cb1c729c..fff606e8b9229 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndicesAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndicesAction.java @@ -44,7 +44,7 @@ public class RestGetIndicesAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/{index}"), new Route(HEAD, "/{index}"))); diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetMappingAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetMappingAction.java index cf0204e31a42f..55b255ca7b633 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetMappingAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetMappingAction.java @@ -42,7 +42,7 @@ public class RestGetMappingAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_mapping"), new Route(GET, "/_mappings"), diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetSettingsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetSettingsAction.java index 80fcdc77a22c2..20058c812b94e 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetSettingsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetSettingsAction.java @@ -37,7 +37,7 @@ public class RestGetSettingsAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_settings"), new Route(GET, "/_settings/{name}"), diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndexDeleteAliasesAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndexDeleteAliasesAction.java index a5b01c96b52fc..ff454ee5354cd 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndexDeleteAliasesAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndexDeleteAliasesAction.java @@ -36,7 +36,7 @@ public class RestIndexDeleteAliasesAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(DELETE, "/{index}/_alias/{name}"), new Route(DELETE, "/{index}/_aliases/{name}"))); diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndexPutAliasAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndexPutAliasAction.java index bb5daf7943fbd..fb6bede4e0ae3 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndexPutAliasAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndexPutAliasAction.java @@ -39,7 +39,7 @@ public class RestIndexPutAliasAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(POST, "/{index}/_alias/{name}"), new Route(PUT, "/{index}/_alias/{name}"), diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesAliasesAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesAliasesAction.java index 133d2d7bde436..e492857747955 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesAliasesAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesAliasesAction.java @@ -40,7 +40,7 @@ public String getName() { } @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(POST, "/_aliases")); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesSegmentsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesSegmentsAction.java index 3f2bd944ae410..e14a83bd3084c 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesSegmentsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesSegmentsAction.java @@ -37,7 +37,7 @@ public class RestIndicesSegmentsAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_segments"), new Route(GET, "/{index}/_segments"))); diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesShardStoresAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesShardStoresAction.java index d0565c9dcfe69..39ff18cade947 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesShardStoresAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesShardStoresAction.java @@ -46,7 +46,7 @@ public class RestIndicesShardStoresAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_shard_stores"), new Route(GET, "/{index}/_shard_stores"))); diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsAction.java index 94e037696a82d..0b2cacc0f53a1 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsAction.java @@ -46,7 +46,7 @@ public class RestIndicesStatsAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_stats"), new Route(GET, "/_stats/{metric}"), diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestOpenIndexAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestOpenIndexAction.java index 3363f5d0f409a..5ffc29e26e11b 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestOpenIndexAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestOpenIndexAction.java @@ -38,7 +38,7 @@ public class RestOpenIndexAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(POST, "/_open"), new Route(POST, "/{index}/_open"))); diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutIndexTemplateAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutIndexTemplateAction.java index 41620b744027c..974602a9fcca6 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutIndexTemplateAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutIndexTemplateAction.java @@ -39,7 +39,7 @@ public class RestPutIndexTemplateAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(POST, "/_template/{name}"), new Route(PUT, "/_template/{name}"))); diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutMappingAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutMappingAction.java index 0ee08b3cb8774..c8f42975640a3 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutMappingAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutMappingAction.java @@ -42,7 +42,7 @@ public class RestPutMappingAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(POST, "/{index}/_mapping/"), new Route(PUT, "/{index}/_mapping/"), diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRecoveryAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRecoveryAction.java index 793d3c9d23e76..ac8744f39c70e 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRecoveryAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRecoveryAction.java @@ -40,7 +40,7 @@ public class RestRecoveryAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_recovery"), new Route(GET, "/{index}/_recovery"))); diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRefreshAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRefreshAction.java index 52bc5df327de8..cae120e50bb46 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRefreshAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRefreshAction.java @@ -40,7 +40,7 @@ public class RestRefreshAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_refresh"), new Route(POST, "/_refresh"), diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestResizeHandler.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestResizeHandler.java index 9d1cfd6318cb5..f26f2cab7989b 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestResizeHandler.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestResizeHandler.java @@ -59,7 +59,7 @@ public final RestChannelConsumer prepareRequest(final RestRequest request, final public static class RestShrinkIndexAction extends RestResizeHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(POST, "/{index}/_shrink/{target}"), new Route(PUT, "/{index}/_shrink/{target}"))); @@ -80,7 +80,7 @@ protected ResizeType getResizeType() { public static class RestSplitIndexAction extends RestResizeHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(POST, "/{index}/_split/{target}"), new Route(PUT, "/{index}/_split/{target}"))); @@ -101,7 +101,7 @@ protected ResizeType getResizeType() { public static class RestCloneIndexAction extends RestResizeHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(POST, "/{index}/_clone/{target}"), new Route(PUT, "/{index}/_clone/{target}"))); diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRolloverIndexAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRolloverIndexAction.java index 08397c7c077c6..580daa864c39e 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRolloverIndexAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRolloverIndexAction.java @@ -36,7 +36,7 @@ public class RestRolloverIndexAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(POST, "/{index}/_rollover"), new Route(POST, "/{index}/_rollover/{new_index}"))); diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestSyncedFlushAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestSyncedFlushAction.java index a8db872534bbb..638db99538cec 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestSyncedFlushAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestSyncedFlushAction.java @@ -50,7 +50,7 @@ public class RestSyncedFlushAction extends BaseRestHandler { private static final DeprecationLogger DEPRECATION_LOGGER = new DeprecationLogger(logger); @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_flush/synced"), new Route(POST, "/_flush/synced"), diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpdateSettingsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpdateSettingsAction.java index c02eb6ec3a3ec..4db7539850567 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpdateSettingsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpdateSettingsAction.java @@ -40,7 +40,7 @@ public class RestUpdateSettingsAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(PUT, "/{index}/_settings"), new Route(PUT, "/_settings"))); diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpgradeActionDeprecated.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpgradeActionDeprecated.java index 52307b0f33c66..769832e7e3e8b 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpgradeActionDeprecated.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpgradeActionDeprecated.java @@ -53,7 +53,7 @@ public List deprecatedRoutes() { } @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpgradeStatusActionDeprecated.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpgradeStatusActionDeprecated.java index 36d97986884d9..30d07283e4665 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpgradeStatusActionDeprecated.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpgradeStatusActionDeprecated.java @@ -51,7 +51,7 @@ public List deprecatedRoutes() { } @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestValidateQueryAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestValidateQueryAction.java index 162d6591e2184..68be9cba956d1 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestValidateQueryAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestValidateQueryAction.java @@ -46,7 +46,7 @@ public class RestValidateQueryAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_validate/query"), new Route(POST, "/_validate/query"), diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestAliasAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestAliasAction.java index 90356ca291ae3..cc96487fd45dc 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestAliasAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestAliasAction.java @@ -38,7 +38,7 @@ public class RestAliasAction extends AbstractCatAction { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_cat/aliases"), new Route(GET, "/_cat/aliases/{alias}"))); diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestAllocationAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestAllocationAction.java index 7f1ca267a2c55..1c81d24c21e21 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestAllocationAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestAllocationAction.java @@ -47,7 +47,7 @@ public class RestAllocationAction extends AbstractCatAction { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_cat/allocation"), new Route(GET, "/_cat/allocation/{nodes}"))); diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestCatAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestCatAction.java index 45a1d09bac535..c545a1bd2f384 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestCatAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestCatAction.java @@ -47,7 +47,7 @@ public RestCatAction(List catActions) { } @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(GET, "/_cat")); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestCatRecoveryAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestCatRecoveryAction.java index 2d9f5774800b9..9e29b17070ccf 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestCatRecoveryAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestCatRecoveryAction.java @@ -52,7 +52,7 @@ public class RestCatRecoveryAction extends AbstractCatAction { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_cat/recovery"), new Route(GET, "/_cat/recovery/{index}"))); diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestCountAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestCountAction.java index 8ccb295ca0fda..fada1e5d35645 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestCountAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestCountAction.java @@ -43,7 +43,7 @@ public class RestCountAction extends AbstractCatAction { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_cat/count"), new Route(GET, "/_cat/count/{index}"))); diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestFielddataAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestFielddataAction.java index 2909471f48156..cc7e16b2ea39f 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestFielddataAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestFielddataAction.java @@ -42,7 +42,7 @@ public class RestFielddataAction extends AbstractCatAction { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_cat/fielddata"), new Route(GET, "/_cat/fielddata/{fields}"))); diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestHealthAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestHealthAction.java index 6971015de1beb..7e859ac0f21a1 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestHealthAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestHealthAction.java @@ -36,7 +36,7 @@ public class RestHealthAction extends AbstractCatAction { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(GET, "/_cat/health")); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestIndicesAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestIndicesAction.java index 72050525dcfb8..d122bc7bd2690 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestIndicesAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestIndicesAction.java @@ -71,7 +71,7 @@ public class RestIndicesAction extends AbstractCatAction { private static final DateFormatter STRICT_DATE_TIME_FORMATTER = DateFormatter.forPattern("strict_date_time"); @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_cat/indices"), new Route(GET, "/_cat/indices/{index}"))); diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestMasterAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestMasterAction.java index 040f6bfd0474b..18dea4625b6fe 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestMasterAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestMasterAction.java @@ -37,7 +37,7 @@ public class RestMasterAction extends AbstractCatAction { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(GET, "/_cat/master")); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodeAttrsAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodeAttrsAction.java index e8ae2c924dcf3..dcb75b22e647f 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodeAttrsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodeAttrsAction.java @@ -43,7 +43,7 @@ public class RestNodeAttrsAction extends AbstractCatAction { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(GET, "/_cat/nodeattrs")); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodesAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodesAction.java index fbe82d847a1ba..a80390a0a04ff 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodesAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodesAction.java @@ -71,7 +71,7 @@ public class RestNodesAction extends AbstractCatAction { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(GET, "/_cat/nodes")); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestPendingClusterTasksAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestPendingClusterTasksAction.java index 4ecad5ec2060d..f3071839612e2 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestPendingClusterTasksAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestPendingClusterTasksAction.java @@ -36,7 +36,7 @@ public class RestPendingClusterTasksAction extends AbstractCatAction { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(GET, "/_cat/pending_tasks")); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestPluginsAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestPluginsAction.java index ee7552647721e..9a50deee98c8e 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestPluginsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestPluginsAction.java @@ -42,7 +42,7 @@ public class RestPluginsAction extends AbstractCatAction { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(GET, "/_cat/plugins")); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestRepositoriesAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestRepositoriesAction.java index d913c042dc13d..e9a5bd6b3aac9 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestRepositoriesAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestRepositoriesAction.java @@ -39,7 +39,7 @@ public class RestRepositoriesAction extends AbstractCatAction { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(GET, "/_cat/repositories")); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestSegmentsAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestSegmentsAction.java index e66862b594150..3c63f7bbdbf30 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestSegmentsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestSegmentsAction.java @@ -46,7 +46,7 @@ public class RestSegmentsAction extends AbstractCatAction { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_cat/segments"), new Route(GET, "/_cat/segments/{index}"))); diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestShardsAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestShardsAction.java index cd0cf91d63967..9a321476efda7 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestShardsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestShardsAction.java @@ -63,7 +63,7 @@ public class RestShardsAction extends AbstractCatAction { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList(new Route(GET, "/_cat/shards"), new Route(GET, "/_cat/shards/{index}"))); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestSnapshotAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestSnapshotAction.java index 91c95a50a27bc..257bf5c1a2205 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestSnapshotAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestSnapshotAction.java @@ -50,7 +50,7 @@ public class RestSnapshotAction extends AbstractCatAction { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_cat/snapshots"), new Route(GET, "/_cat/snapshots/{repository}"))); diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestTasksAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestTasksAction.java index 86dc518de7c8d..2868d16d682fa 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestTasksAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestTasksAction.java @@ -55,7 +55,7 @@ public RestTasksAction(Supplier nodesInCluster) { } @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(GET, "/_cat/tasks")); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestTemplatesAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestTemplatesAction.java index 3622d7529e70b..fb9946d5acfe0 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestTemplatesAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestTemplatesAction.java @@ -40,7 +40,7 @@ public class RestTemplatesAction extends AbstractCatAction { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_cat/templates"), new Route(GET, "/_cat/templates/{name}"))); diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestThreadPoolAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestThreadPoolAction.java index c0b717380315f..caaaeba07b964 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestThreadPoolAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestThreadPoolAction.java @@ -54,7 +54,7 @@ public class RestThreadPoolAction extends AbstractCatAction { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_cat/thread_pool"), new Route(GET, "/_cat/thread_pool/{thread_pool_patterns}"))); diff --git a/server/src/main/java/org/elasticsearch/rest/action/document/RestBulkAction.java b/server/src/main/java/org/elasticsearch/rest/action/document/RestBulkAction.java index 88813c8878a15..b9a36d181b3aa 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/document/RestBulkAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/document/RestBulkAction.java @@ -56,7 +56,7 @@ public RestBulkAction(Settings settings) { } @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(POST, "/_bulk"), new Route(PUT, "/_bulk"), diff --git a/server/src/main/java/org/elasticsearch/rest/action/document/RestDeleteAction.java b/server/src/main/java/org/elasticsearch/rest/action/document/RestDeleteAction.java index a0de9d9928a9a..8e46244101e74 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/document/RestDeleteAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/document/RestDeleteAction.java @@ -37,7 +37,7 @@ public class RestDeleteAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(DELETE, "/{index}/_doc/{id}")); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/document/RestGetAction.java b/server/src/main/java/org/elasticsearch/rest/action/document/RestGetAction.java index 11eb6575b60b2..54f1f954f816d 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/document/RestGetAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/document/RestGetAction.java @@ -49,7 +49,7 @@ public String getName() { } @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/{index}/_doc/{id}"), new Route(HEAD, "/{index}/_doc/{id}"))); diff --git a/server/src/main/java/org/elasticsearch/rest/action/document/RestGetSourceAction.java b/server/src/main/java/org/elasticsearch/rest/action/document/RestGetSourceAction.java index cf0e92a5627dc..72bc4538cbbe6 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/document/RestGetSourceAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/document/RestGetSourceAction.java @@ -51,7 +51,7 @@ public class RestGetSourceAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/{index}/_source/{id}"), new Route(HEAD, "/{index}/_source/{id}"))); diff --git a/server/src/main/java/org/elasticsearch/rest/action/document/RestIndexAction.java b/server/src/main/java/org/elasticsearch/rest/action/document/RestIndexAction.java index e2de8fdea410b..ef52af60e6efb 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/document/RestIndexAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/document/RestIndexAction.java @@ -43,7 +43,7 @@ public class RestIndexAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(POST, "/{index}/_doc/{id}"), new Route(PUT, "/{index}/_doc/{id}"))); @@ -62,7 +62,7 @@ public String getName() { } @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(POST, "/{index}/_create/{id}"), new Route(PUT, "/{index}/_create/{id}"))); @@ -96,7 +96,7 @@ public String getName() { } @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(POST, "/{index}/_doc")); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/document/RestMultiGetAction.java b/server/src/main/java/org/elasticsearch/rest/action/document/RestMultiGetAction.java index c5554981107bf..c9fd67d678150 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/document/RestMultiGetAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/document/RestMultiGetAction.java @@ -46,7 +46,7 @@ public RestMultiGetAction(Settings settings) { } @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_mget"), new Route(POST, "/_mget"), diff --git a/server/src/main/java/org/elasticsearch/rest/action/document/RestMultiTermVectorsAction.java b/server/src/main/java/org/elasticsearch/rest/action/document/RestMultiTermVectorsAction.java index 42279e7a75b77..504620a58f7e5 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/document/RestMultiTermVectorsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/document/RestMultiTermVectorsAction.java @@ -38,7 +38,7 @@ public class RestMultiTermVectorsAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_mtermvectors"), new Route(POST, "/_mtermvectors"), diff --git a/server/src/main/java/org/elasticsearch/rest/action/document/RestTermVectorsAction.java b/server/src/main/java/org/elasticsearch/rest/action/document/RestTermVectorsAction.java index 51deaa01ea837..b9c2e12cbf0c4 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/document/RestTermVectorsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/document/RestTermVectorsAction.java @@ -46,7 +46,7 @@ public class RestTermVectorsAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/{index}/_termvectors"), new Route(POST, "/{index}/_termvectors"), diff --git a/server/src/main/java/org/elasticsearch/rest/action/document/RestUpdateAction.java b/server/src/main/java/org/elasticsearch/rest/action/document/RestUpdateAction.java index af1b99283e609..2ef58e23e1594 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/document/RestUpdateAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/document/RestUpdateAction.java @@ -40,7 +40,7 @@ public class RestUpdateAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(POST, "/{index}/_update/{id}")); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/ingest/RestDeletePipelineAction.java b/server/src/main/java/org/elasticsearch/rest/action/ingest/RestDeletePipelineAction.java index 1543a39bf5e6d..2956811e26fed 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/ingest/RestDeletePipelineAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/ingest/RestDeletePipelineAction.java @@ -33,7 +33,7 @@ public class RestDeletePipelineAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(DELETE, "/_ingest/pipeline/{id}")); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/ingest/RestGetPipelineAction.java b/server/src/main/java/org/elasticsearch/rest/action/ingest/RestGetPipelineAction.java index 6a5617a48f4c2..1e4e016027b8e 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/ingest/RestGetPipelineAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/ingest/RestGetPipelineAction.java @@ -36,7 +36,7 @@ public class RestGetPipelineAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_ingest/pipeline"), new Route(GET, "/_ingest/pipeline/{id}"))); diff --git a/server/src/main/java/org/elasticsearch/rest/action/ingest/RestPutPipelineAction.java b/server/src/main/java/org/elasticsearch/rest/action/ingest/RestPutPipelineAction.java index 173311e89e65e..b1fb8086e0653 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/ingest/RestPutPipelineAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/ingest/RestPutPipelineAction.java @@ -38,7 +38,7 @@ public class RestPutPipelineAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(PUT, "/_ingest/pipeline/{id}")); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/ingest/RestSimulatePipelineAction.java b/server/src/main/java/org/elasticsearch/rest/action/ingest/RestSimulatePipelineAction.java index 36e0d9f89606e..1ac0bdd6fcd5a 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/ingest/RestSimulatePipelineAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/ingest/RestSimulatePipelineAction.java @@ -39,7 +39,7 @@ public class RestSimulatePipelineAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_ingest/pipeline/{id}/_simulate"), new Route(POST, "/_ingest/pipeline/{id}/_simulate"), diff --git a/server/src/main/java/org/elasticsearch/rest/action/search/RestClearScrollAction.java b/server/src/main/java/org/elasticsearch/rest/action/search/RestClearScrollAction.java index 65b5bb959a991..90e8f95227ceb 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/search/RestClearScrollAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/search/RestClearScrollAction.java @@ -36,7 +36,7 @@ public class RestClearScrollAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(DELETE, "/_search/scroll"), new Route(DELETE, "/_search/scroll/{scroll_id}"))); diff --git a/server/src/main/java/org/elasticsearch/rest/action/search/RestCountAction.java b/server/src/main/java/org/elasticsearch/rest/action/search/RestCountAction.java index c3d258512609d..cc3211d2bf213 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/search/RestCountAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/search/RestCountAction.java @@ -47,7 +47,7 @@ public class RestCountAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_count"), new Route(POST, "/_count"), diff --git a/server/src/main/java/org/elasticsearch/rest/action/search/RestExplainAction.java b/server/src/main/java/org/elasticsearch/rest/action/search/RestExplainAction.java index 494f137cb1387..9ee2a4ee79e28 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/search/RestExplainAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/search/RestExplainAction.java @@ -43,7 +43,7 @@ public class RestExplainAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/{index}/_explain/{id}"), new Route(POST, "/{index}/_explain/{id}"))); diff --git a/server/src/main/java/org/elasticsearch/rest/action/search/RestMultiSearchAction.java b/server/src/main/java/org/elasticsearch/rest/action/search/RestMultiSearchAction.java index 93f1f856de7e9..6966e67edeac4 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/search/RestMultiSearchAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/search/RestMultiSearchAction.java @@ -66,7 +66,7 @@ public RestMultiSearchAction(Settings settings) { } @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_msearch"), new Route(POST, "/_msearch"), diff --git a/server/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java b/server/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java index 1eab74a1bd5f9..782c613a36277 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java @@ -76,7 +76,7 @@ public String getName() { } @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_search"), new Route(POST, "/_search"), diff --git a/server/src/main/java/org/elasticsearch/rest/action/search/RestSearchScrollAction.java b/server/src/main/java/org/elasticsearch/rest/action/search/RestSearchScrollAction.java index 8ec72a62937ef..6060574a7dbc7 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/search/RestSearchScrollAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/search/RestSearchScrollAction.java @@ -46,7 +46,7 @@ public String getName() { } @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_search/scroll"), new Route(POST, "/_search/scroll"), diff --git a/server/src/test/java/org/elasticsearch/action/ActionModuleTests.java b/server/src/test/java/org/elasticsearch/action/ActionModuleTests.java index 5d70a0c98f7bf..1d2c67d6d2b0f 100644 --- a/server/src/test/java/org/elasticsearch/action/ActionModuleTests.java +++ b/server/src/test/java/org/elasticsearch/action/ActionModuleTests.java @@ -119,7 +119,7 @@ public void handleRequest(RestRequest request, RestChannel channel, NodeClient c } @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(Method.GET, "/")); } })); @@ -152,7 +152,7 @@ public List getRestHandlers(Settings settings, RestController restC public void testPluginCanRegisterRestHandler() { class FakeHandler implements RestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(Method.GET, "/_dummy")); } @@ -185,7 +185,7 @@ public void handleRequest(RestRequest request, RestChannel channel, NodeClient c } @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(Method.GET, "/_dummy")); } })); diff --git a/server/src/test/java/org/elasticsearch/rest/BaseRestHandlerTests.java b/server/src/test/java/org/elasticsearch/rest/BaseRestHandlerTests.java index 7f9ab8ac1c32b..c412af527507f 100644 --- a/server/src/test/java/org/elasticsearch/rest/BaseRestHandlerTests.java +++ b/server/src/test/java/org/elasticsearch/rest/BaseRestHandlerTests.java @@ -58,7 +58,7 @@ public String getName() { } @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } }; @@ -89,7 +89,7 @@ public String getName() { } @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } }; @@ -130,7 +130,7 @@ public String getName() { } @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } }; @@ -178,7 +178,7 @@ public String getName() { } @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } }; @@ -206,7 +206,7 @@ public String getName() { } @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } }; @@ -246,7 +246,7 @@ public String getName() { } @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } }; @@ -281,7 +281,7 @@ public String getName() { } @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } }; @@ -310,7 +310,7 @@ public String getName() { } @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } }; @@ -335,7 +335,7 @@ public String getName() { } @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } }; diff --git a/server/src/test/java/org/elasticsearch/usage/UsageServiceTests.java b/server/src/test/java/org/elasticsearch/usage/UsageServiceTests.java index 845851b3e3516..cfba6390bfb07 100644 --- a/server/src/test/java/org/elasticsearch/usage/UsageServiceTests.java +++ b/server/src/test/java/org/elasticsearch/usage/UsageServiceTests.java @@ -103,7 +103,7 @@ public String getName() { } @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/rest/RestGetAutoscalingDecisionHandler.java b/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/rest/RestGetAutoscalingDecisionHandler.java index 2164065eae406..72532091a89a7 100644 --- a/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/rest/RestGetAutoscalingDecisionHandler.java +++ b/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/rest/RestGetAutoscalingDecisionHandler.java @@ -20,7 +20,7 @@ public class RestGetAutoscalingDecisionHandler extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(GET, "/_autoscaling/decision")); } diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestCcrStatsAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestCcrStatsAction.java index f22368b3e442d..e320595690a25 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestCcrStatsAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestCcrStatsAction.java @@ -20,7 +20,7 @@ public class RestCcrStatsAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(GET, "/_ccr/stats")); } diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestDeleteAutoFollowPatternAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestDeleteAutoFollowPatternAction.java index ece99212dab10..853b8f7d6da15 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestDeleteAutoFollowPatternAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestDeleteAutoFollowPatternAction.java @@ -20,7 +20,7 @@ public class RestDeleteAutoFollowPatternAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(DELETE, "/_ccr/auto_follow/{name}")); } diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestFollowInfoAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestFollowInfoAction.java index 077dd190dc3d9..e9763a43a7b07 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestFollowInfoAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestFollowInfoAction.java @@ -21,7 +21,7 @@ public class RestFollowInfoAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(GET, "/{index}/_ccr/info")); } diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestFollowStatsAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestFollowStatsAction.java index 030ae367fa87f..2eed47b0a7abc 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestFollowStatsAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestFollowStatsAction.java @@ -21,7 +21,7 @@ public class RestFollowStatsAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(GET, "/{index}/_ccr/stats")); } diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestForgetFollowerAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestForgetFollowerAction.java index ee8c79ff2c374..bb8246a7a780b 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestForgetFollowerAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestForgetFollowerAction.java @@ -23,7 +23,7 @@ public class RestForgetFollowerAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(POST, "/{index}/_ccr/forget_follower")); } diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestGetAutoFollowPatternAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestGetAutoFollowPatternAction.java index 75f63ece47233..7a7454c02fe18 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestGetAutoFollowPatternAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestGetAutoFollowPatternAction.java @@ -21,7 +21,7 @@ public class RestGetAutoFollowPatternAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_ccr/auto_follow/{name}"), new Route(GET, "/_ccr/auto_follow"))); diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPauseAutoFollowPatternAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPauseAutoFollowPatternAction.java index 6e5e6f8648b66..04d6747a78aaf 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPauseAutoFollowPatternAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPauseAutoFollowPatternAction.java @@ -20,7 +20,7 @@ public class RestPauseAutoFollowPatternAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(POST, "/_ccr/auto_follow/{name}/pause")); } diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPauseFollowAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPauseFollowAction.java index 669c412b80696..2bfec8f87e28b 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPauseFollowAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPauseFollowAction.java @@ -20,7 +20,7 @@ public class RestPauseFollowAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(POST, "/{index}/_ccr/pause_follow")); } diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPutAutoFollowPatternAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPutAutoFollowPatternAction.java index cc411f47d3b1f..5593aa7ac6155 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPutAutoFollowPatternAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPutAutoFollowPatternAction.java @@ -22,7 +22,7 @@ public class RestPutAutoFollowPatternAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(PUT, "/_ccr/auto_follow/{name}")); } diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPutFollowAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPutFollowAction.java index 128464ca0ffb2..9ee161555bdca 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPutFollowAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestPutFollowAction.java @@ -23,7 +23,7 @@ public class RestPutFollowAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(PUT, "/{index}/_ccr/follow")); } diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestResumeAutoFollowPatternAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestResumeAutoFollowPatternAction.java index 1c321e5768e3e..e20c038dff1e0 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestResumeAutoFollowPatternAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestResumeAutoFollowPatternAction.java @@ -20,7 +20,7 @@ public class RestResumeAutoFollowPatternAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(POST, "/_ccr/auto_follow/{name}/resume")); } diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestResumeFollowAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestResumeFollowAction.java index 53547999ac7a7..146700888cfc8 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestResumeFollowAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestResumeFollowAction.java @@ -22,7 +22,7 @@ public class RestResumeFollowAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(POST, "/{index}/_ccr/resume_follow")); } diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestUnfollowAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestUnfollowAction.java index 35b037bec4acc..0effd10b7f196 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestUnfollowAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestUnfollowAction.java @@ -21,7 +21,7 @@ public class RestUnfollowAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(POST, "/{index}/_ccr/unfollow")); } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestDeleteLicenseAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestDeleteLicenseAction.java index 554f3da36f450..0addc72d201da 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestDeleteLicenseAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestDeleteLicenseAction.java @@ -23,7 +23,7 @@ public class RestDeleteLicenseAction extends BaseRestHandler { RestDeleteLicenseAction() {} @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(DELETE, "/_license")); } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetBasicStatus.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetBasicStatus.java index ac48fc981fa0d..baf17b2cd75a4 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetBasicStatus.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetBasicStatus.java @@ -21,7 +21,7 @@ public class RestGetBasicStatus extends BaseRestHandler { RestGetBasicStatus() {} @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(GET, "/_license/basic_status")); } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetLicenseAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetLicenseAction.java index 85ca1e061e135..33b013954be97 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetLicenseAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetLicenseAction.java @@ -35,7 +35,7 @@ public class RestGetLicenseAction extends BaseRestHandler { RestGetLicenseAction() {} @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(GET, "/_license")); } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetTrialStatus.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetTrialStatus.java index 29d046436bf38..ea90b85f15e61 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetTrialStatus.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetTrialStatus.java @@ -21,7 +21,7 @@ public class RestGetTrialStatus extends BaseRestHandler { RestGetTrialStatus() {} @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(GET, "/_license/trial_status")); } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPostStartBasicLicense.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPostStartBasicLicense.java index 792a9705f26e1..2346e143cc7e0 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPostStartBasicLicense.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPostStartBasicLicense.java @@ -22,7 +22,7 @@ public class RestPostStartBasicLicense extends BaseRestHandler { RestPostStartBasicLicense() {} @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(POST, "/_license/start_basic")); } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPostStartTrialLicense.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPostStartTrialLicense.java index bf5430a7c8303..b9ecb91c9eb27 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPostStartTrialLicense.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPostStartTrialLicense.java @@ -26,7 +26,7 @@ public class RestPostStartTrialLicense extends BaseRestHandler { RestPostStartTrialLicense() {} @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(POST, "/_license/start_trial")); } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPutLicenseAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPutLicenseAction.java index f6be2e4229c34..4634a56c66f9f 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPutLicenseAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPutLicenseAction.java @@ -24,7 +24,7 @@ public class RestPutLicenseAction extends BaseRestHandler { RestPutLicenseAction() {} @Override - public List handledRoutes() { + public List routes() { // TODO: remove POST endpoint? return unmodifiableList(asList( new Route(POST, "/_license"), diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rest/action/RestReloadAnalyzersAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rest/action/RestReloadAnalyzersAction.java index d4f957f22e9e2..8d118960ed1f2 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rest/action/RestReloadAnalyzersAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rest/action/RestReloadAnalyzersAction.java @@ -25,7 +25,7 @@ public class RestReloadAnalyzersAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/{index}/_reload_search_analyzers"), new Route(POST, "/{index}/_reload_search_analyzers"))); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rest/action/RestXPackInfoAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rest/action/RestXPackInfoAction.java index c80b35c0f1939..6d83cd97e0df8 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rest/action/RestXPackInfoAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rest/action/RestXPackInfoAction.java @@ -24,7 +24,7 @@ public class RestXPackInfoAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_xpack"), new Route(HEAD, "/_xpack"))); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rest/action/RestXPackUsageAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rest/action/RestXPackUsageAction.java index 3eb6570674758..86bfd8f5241f9 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rest/action/RestXPackUsageAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rest/action/RestXPackUsageAction.java @@ -28,7 +28,7 @@ public class RestXPackUsageAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(GET, "/_xpack/usage")); } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/rest/RestGetCertificateInfoAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/rest/RestGetCertificateInfoAction.java index 56a2ad1669397..3f6348b0b6ac2 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/rest/RestGetCertificateInfoAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/rest/RestGetCertificateInfoAction.java @@ -28,7 +28,7 @@ public class RestGetCertificateInfoAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(GET, "/_ssl/certificates")); } diff --git a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/RestDeprecationInfoAction.java b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/RestDeprecationInfoAction.java index cc45effd94ef2..1070d90d233e3 100644 --- a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/RestDeprecationInfoAction.java +++ b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/RestDeprecationInfoAction.java @@ -23,7 +23,7 @@ public class RestDeprecationInfoAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_migration/deprecations"), new Route(GET, "/{index}/_migration/deprecations"))); diff --git a/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestDeleteEnrichPolicyAction.java b/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestDeleteEnrichPolicyAction.java index 57ad67c4cdb10..c8ff6fa5337de 100644 --- a/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestDeleteEnrichPolicyAction.java +++ b/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestDeleteEnrichPolicyAction.java @@ -20,7 +20,7 @@ public class RestDeleteEnrichPolicyAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(DELETE, "/_enrich/policy/{name}")); } diff --git a/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestEnrichStatsAction.java b/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestEnrichStatsAction.java index 8727be5cb56c3..4b74bcd3a64c0 100644 --- a/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestEnrichStatsAction.java +++ b/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestEnrichStatsAction.java @@ -20,7 +20,7 @@ public class RestEnrichStatsAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(GET, "/_enrich/_stats")); } diff --git a/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestExecuteEnrichPolicyAction.java b/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestExecuteEnrichPolicyAction.java index d944b5a0b3111..c6515876a7615 100644 --- a/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestExecuteEnrichPolicyAction.java +++ b/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestExecuteEnrichPolicyAction.java @@ -22,7 +22,7 @@ public class RestExecuteEnrichPolicyAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList( asList(new Route(POST, "/_enrich/policy/{name}/_execute"), new Route(PUT, "/_enrich/policy/{name}/_execute")) ); diff --git a/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestGetEnrichPolicyAction.java b/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestGetEnrichPolicyAction.java index 3c146a5de1777..06e516592f7f6 100644 --- a/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestGetEnrichPolicyAction.java +++ b/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestGetEnrichPolicyAction.java @@ -22,7 +22,7 @@ public class RestGetEnrichPolicyAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList(new Route(GET, "/_enrich/policy/{name}"), new Route(GET, "/_enrich/policy"))); } diff --git a/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestPutEnrichPolicyAction.java b/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestPutEnrichPolicyAction.java index 1ed51cbc7d384..8750891d34db0 100644 --- a/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestPutEnrichPolicyAction.java +++ b/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/rest/RestPutEnrichPolicyAction.java @@ -21,7 +21,7 @@ public class RestPutEnrichPolicyAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(PUT, "/_enrich/policy/{name}")); } diff --git a/x-pack/plugin/eql/src/main/java/org/elasticsearch/xpack/eql/plugin/RestEqlSearchAction.java b/x-pack/plugin/eql/src/main/java/org/elasticsearch/xpack/eql/plugin/RestEqlSearchAction.java index 1a4b23f6ec99f..c81b1b0319465 100644 --- a/x-pack/plugin/eql/src/main/java/org/elasticsearch/xpack/eql/plugin/RestEqlSearchAction.java +++ b/x-pack/plugin/eql/src/main/java/org/elasticsearch/xpack/eql/plugin/RestEqlSearchAction.java @@ -32,7 +32,7 @@ public class RestEqlSearchAction extends BaseRestHandler { private static final String SEARCH_PATH = "/{index}/_eql/search"; @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, SEARCH_PATH), new Route(POST, SEARCH_PATH))); diff --git a/x-pack/plugin/frozen-indices/src/main/java/org/elasticsearch/xpack/frozen/rest/action/RestFreezeIndexAction.java b/x-pack/plugin/frozen-indices/src/main/java/org/elasticsearch/xpack/frozen/rest/action/RestFreezeIndexAction.java index aa7e941de32da..96cde5f4e3a22 100644 --- a/x-pack/plugin/frozen-indices/src/main/java/org/elasticsearch/xpack/frozen/rest/action/RestFreezeIndexAction.java +++ b/x-pack/plugin/frozen-indices/src/main/java/org/elasticsearch/xpack/frozen/rest/action/RestFreezeIndexAction.java @@ -24,7 +24,7 @@ public final class RestFreezeIndexAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(POST, "/{index}/_freeze"), new Route(POST, "/{index}/_unfreeze"))); diff --git a/x-pack/plugin/graph/src/main/java/org/elasticsearch/xpack/graph/rest/action/RestGraphAction.java b/x-pack/plugin/graph/src/main/java/org/elasticsearch/xpack/graph/rest/action/RestGraphAction.java index b6c6dbc22b391..e84b2441d6bbb 100644 --- a/x-pack/plugin/graph/src/main/java/org/elasticsearch/xpack/graph/rest/action/RestGraphAction.java +++ b/x-pack/plugin/graph/src/main/java/org/elasticsearch/xpack/graph/rest/action/RestGraphAction.java @@ -59,7 +59,7 @@ public class RestGraphAction extends BaseRestHandler { public static final ParseField TERM_FIELD = new ParseField("term"); @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/{index}/_graph/explore"), new Route(POST, "/{index}/_graph/explore"))); diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestDeleteLifecycleAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestDeleteLifecycleAction.java index 221c39850d276..e2155b0b1698b 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestDeleteLifecycleAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestDeleteLifecycleAction.java @@ -20,7 +20,7 @@ public class RestDeleteLifecycleAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(DELETE, "/_ilm/policy/{name}")); } diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestExplainLifecycleAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestExplainLifecycleAction.java index 50cbcca649de9..68b843794274a 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestExplainLifecycleAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestExplainLifecycleAction.java @@ -23,7 +23,7 @@ public class RestExplainLifecycleAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(GET, "/{index}/_ilm/explain")); } diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestGetLifecycleAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestGetLifecycleAction.java index f858af2632c79..df4af5ff58957 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestGetLifecycleAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestGetLifecycleAction.java @@ -22,7 +22,7 @@ public class RestGetLifecycleAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_ilm/policy"), new Route(GET, "/_ilm/policy/{name}"))); diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestGetStatusAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestGetStatusAction.java index 0a7f0406322ce..1eb822ba765c3 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestGetStatusAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestGetStatusAction.java @@ -20,7 +20,7 @@ public class RestGetStatusAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(GET, "/_ilm/status")); } diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestMoveToStepAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestMoveToStepAction.java index f1b19942b9608..0f072787d3f5f 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestMoveToStepAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestMoveToStepAction.java @@ -23,7 +23,7 @@ public class RestMoveToStepAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(POST, "/_ilm/move/{name}")); } diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestPutLifecycleAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestPutLifecycleAction.java index 493b7fd317a16..9f2f199ca6025 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestPutLifecycleAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestPutLifecycleAction.java @@ -22,7 +22,7 @@ public class RestPutLifecycleAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(PUT, "/_ilm/policy/{name}")); } diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestRemoveIndexLifecyclePolicyAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestRemoveIndexLifecyclePolicyAction.java index 9fed8b0c10901..b10b2e4e282f8 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestRemoveIndexLifecyclePolicyAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestRemoveIndexLifecyclePolicyAction.java @@ -22,7 +22,7 @@ public class RestRemoveIndexLifecyclePolicyAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(POST, "/{index}/_ilm/remove")); } diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestRetryAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestRetryAction.java index c42c799d887c0..765ba44d1ffd3 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestRetryAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestRetryAction.java @@ -23,7 +23,7 @@ public class RestRetryAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(POST, "/{index}/_ilm/retry")); } diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestStartILMAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestStartILMAction.java index d1df3cbb0881c..f60ae2297d7fe 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestStartILMAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestStartILMAction.java @@ -21,7 +21,7 @@ public class RestStartILMAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(POST, "/_ilm/start")); } diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestStopAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestStopAction.java index befbd911d5449..8b748ee677ffe 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestStopAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestStopAction.java @@ -21,7 +21,7 @@ public class RestStopAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(POST, "/_ilm/stop")); } diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestDeleteSnapshotLifecycleAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestDeleteSnapshotLifecycleAction.java index f7cdd1a0463aa..fad46639bcc0f 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestDeleteSnapshotLifecycleAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestDeleteSnapshotLifecycleAction.java @@ -20,7 +20,7 @@ public class RestDeleteSnapshotLifecycleAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(DELETE, "/_slm/policy/{name}")); } diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestExecuteSnapshotLifecycleAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestExecuteSnapshotLifecycleAction.java index 56c889901e610..093c52ffbe3ce 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestExecuteSnapshotLifecycleAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestExecuteSnapshotLifecycleAction.java @@ -22,7 +22,7 @@ public class RestExecuteSnapshotLifecycleAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(POST, "/_slm/policy/{name}/_execute"), new Route(PUT, "/_slm/policy/{name}/_execute"))); diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestExecuteSnapshotRetentionAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestExecuteSnapshotRetentionAction.java index 3c48edf3bb1f1..326ee5294e52c 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestExecuteSnapshotRetentionAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestExecuteSnapshotRetentionAction.java @@ -20,7 +20,7 @@ public class RestExecuteSnapshotRetentionAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(POST, "/_slm/_execute_retention")); } diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestGetSLMStatusAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestGetSLMStatusAction.java index 34ffd979d7a06..f728fb314ddce 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestGetSLMStatusAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestGetSLMStatusAction.java @@ -20,7 +20,7 @@ public class RestGetSLMStatusAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(GET, "/_slm/status")); } diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestGetSnapshotLifecycleAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestGetSnapshotLifecycleAction.java index 31fdfa4f4e2f2..6b7841802599a 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestGetSnapshotLifecycleAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestGetSnapshotLifecycleAction.java @@ -22,7 +22,7 @@ public class RestGetSnapshotLifecycleAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_slm/policy"), new Route(GET, "/_slm/policy/{name}"))); diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestGetSnapshotLifecycleStatsAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestGetSnapshotLifecycleStatsAction.java index b76340d90bc1b..688c271a16544 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestGetSnapshotLifecycleStatsAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestGetSnapshotLifecycleStatsAction.java @@ -20,7 +20,7 @@ public class RestGetSnapshotLifecycleStatsAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(GET, "/_slm/stats")); } diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestPutSnapshotLifecycleAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestPutSnapshotLifecycleAction.java index 8fa8fafef2a2d..c4416c2eb6d6c 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestPutSnapshotLifecycleAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestPutSnapshotLifecycleAction.java @@ -22,7 +22,7 @@ public class RestPutSnapshotLifecycleAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(PUT, "/_slm/policy/{name}")); } diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestStartSLMAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestStartSLMAction.java index 8bb8d1d0ce086..da71efbe504b2 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestStartSLMAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestStartSLMAction.java @@ -20,7 +20,7 @@ public class RestStartSLMAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(POST, "/_slm/start")); } diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestStopSLMAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestStopSLMAction.java index 9a4c11d2c8672..1a0af84c31f74 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestStopSLMAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/action/RestStopSLMAction.java @@ -20,7 +20,7 @@ public class RestStopSLMAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(POST, "/_slm/stop")); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestDeleteExpiredDataAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestDeleteExpiredDataAction.java index ccb49fe564fb1..11ca99d9d3a5c 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestDeleteExpiredDataAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestDeleteExpiredDataAction.java @@ -26,7 +26,7 @@ public class RestDeleteExpiredDataAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestDeleteExpiredDataAction.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestFindFileStructureAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestFindFileStructureAction.java index 6aa6a9c95eeb6..94e7ffc15c668 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestFindFileStructureAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestFindFileStructureAction.java @@ -34,7 +34,7 @@ public class RestFindFileStructureAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestFindFileStructureAction.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestMlInfoAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestMlInfoAction.java index 8f1704eabae30..c29b3ad685015 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestMlInfoAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestMlInfoAction.java @@ -26,7 +26,7 @@ public class RestMlInfoAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestMlInfoAction.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestSetUpgradeModeAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestSetUpgradeModeAction.java index fc74b37debb6a..31bc22e99c403 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestSetUpgradeModeAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestSetUpgradeModeAction.java @@ -26,7 +26,7 @@ public class RestSetUpgradeModeAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestSetUpgradeModeAction.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestDeleteCalendarAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestDeleteCalendarAction.java index d33200757e61d..58f5fff7b44a6 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestDeleteCalendarAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestDeleteCalendarAction.java @@ -27,7 +27,7 @@ public class RestDeleteCalendarAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestDeleteCalendarAction.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestDeleteCalendarEventAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestDeleteCalendarEventAction.java index 00191d34d02f3..9fbc3b3ba50fb 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestDeleteCalendarEventAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestDeleteCalendarEventAction.java @@ -28,7 +28,7 @@ public class RestDeleteCalendarEventAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestDeleteCalendarEventAction.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestDeleteCalendarJobAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestDeleteCalendarJobAction.java index 8d43a580b1b32..61fbda4f3f2a3 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestDeleteCalendarJobAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestDeleteCalendarJobAction.java @@ -28,7 +28,7 @@ public class RestDeleteCalendarJobAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestDeleteCalendarJobAction.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestGetCalendarEventsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestGetCalendarEventsAction.java index 50926b5b2db08..c3baeebfbee9c 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestGetCalendarEventsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestGetCalendarEventsAction.java @@ -30,7 +30,7 @@ public class RestGetCalendarEventsAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestGetCalendarEventsAction.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestGetCalendarsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestGetCalendarsAction.java index d2d9dc07505db..eb2e74b309b15 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestGetCalendarsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestGetCalendarsAction.java @@ -32,7 +32,7 @@ public class RestGetCalendarsAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestGetCalendarsAction.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestPostCalendarEventAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestPostCalendarEventAction.java index e670695c8822e..dfab91e85cb8c 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestPostCalendarEventAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestPostCalendarEventAction.java @@ -28,7 +28,7 @@ public class RestPostCalendarEventAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestPostCalendarEventAction.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestPutCalendarAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestPutCalendarAction.java index 0d2d2c57ff075..caba1a115cf75 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestPutCalendarAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestPutCalendarAction.java @@ -28,7 +28,7 @@ public class RestPutCalendarAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestPutCalendarAction.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestPutCalendarJobAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestPutCalendarJobAction.java index 03de5130b63ce..4c8709742aa5c 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestPutCalendarJobAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestPutCalendarJobAction.java @@ -28,7 +28,7 @@ public class RestPutCalendarJobAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestPutCalendarJobAction.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/cat/RestCatDatafeedsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/cat/RestCatDatafeedsAction.java index 19967ab82146f..6617c8046fa3f 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/cat/RestCatDatafeedsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/cat/RestCatDatafeedsAction.java @@ -28,7 +28,7 @@ public class RestCatDatafeedsAction extends AbstractCatAction { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "_cat/ml/datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}"), new Route(GET, "_cat/ml/datafeeds"))); diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/cat/RestCatJobsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/cat/RestCatJobsAction.java index b826f9d644474..55bd15aaf80be 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/cat/RestCatJobsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/cat/RestCatJobsAction.java @@ -33,7 +33,7 @@ public class RestCatJobsAction extends AbstractCatAction { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "_cat/ml/anomaly_detectors/{" + Job.ID.getPreferredName() + "}"), new Route(GET, "_cat/ml/anomaly_detectors"))); diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/cat/RestCatTrainedModelsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/cat/RestCatTrainedModelsAction.java index b31fde9168763..d827f4830a7b0 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/cat/RestCatTrainedModelsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/cat/RestCatTrainedModelsAction.java @@ -45,7 +45,7 @@ public class RestCatTrainedModelsAction extends AbstractCatAction { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "_cat/ml/trained_models"), new Route(GET, "_cat/ml/trained_models/{" + TrainedModelConfig.MODEL_ID.getPreferredName() + "}"))); diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestDeleteDatafeedAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestDeleteDatafeedAction.java index 28805d91c76c8..e692688e30c90 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestDeleteDatafeedAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestDeleteDatafeedAction.java @@ -28,7 +28,7 @@ public class RestDeleteDatafeedAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestDeleteDatafeedAction.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestGetDatafeedStatsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestGetDatafeedStatsAction.java index 0cd9a0b5a7fcd..3a617808d4fdd 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestGetDatafeedStatsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestGetDatafeedStatsAction.java @@ -29,7 +29,7 @@ public class RestGetDatafeedStatsAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestGetDatafeedStatsAction.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestGetDatafeedsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestGetDatafeedsAction.java index f4d6a155a8809..19a4de3dd1401 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestGetDatafeedsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestGetDatafeedsAction.java @@ -28,7 +28,7 @@ public class RestGetDatafeedsAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestGetDatafeedsAction.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestPreviewDatafeedAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestPreviewDatafeedAction.java index a006d1e662768..85b28bbc14382 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestPreviewDatafeedAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestPreviewDatafeedAction.java @@ -27,7 +27,7 @@ public class RestPreviewDatafeedAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestPreviewDatafeedAction.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestPutDatafeedAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestPutDatafeedAction.java index d80dfa77b68b5..bff6f803ffbde 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestPutDatafeedAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestPutDatafeedAction.java @@ -28,7 +28,7 @@ public class RestPutDatafeedAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestPutDatafeedAction.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestStartDatafeedAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestStartDatafeedAction.java index 26ba61ff7a53e..2e61d71b29cab 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestStartDatafeedAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestStartDatafeedAction.java @@ -36,7 +36,7 @@ public class RestStartDatafeedAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestStartDatafeedAction.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestStopDatafeedAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestStopDatafeedAction.java index a511af60c903f..efbc6d01a895c 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestStopDatafeedAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestStopDatafeedAction.java @@ -34,7 +34,7 @@ public class RestStopDatafeedAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestStopDatafeedAction.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestUpdateDatafeedAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestUpdateDatafeedAction.java index fac6596e69b76..6c4e03f39f969 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestUpdateDatafeedAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestUpdateDatafeedAction.java @@ -28,7 +28,7 @@ public class RestUpdateDatafeedAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestUpdateDatafeedAction.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestDeleteDataFrameAnalyticsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestDeleteDataFrameAnalyticsAction.java index 2b59cb43471e0..3b898e870ad44 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestDeleteDataFrameAnalyticsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestDeleteDataFrameAnalyticsAction.java @@ -22,7 +22,7 @@ public class RestDeleteDataFrameAnalyticsAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList( new Route(DELETE, MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}")); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestEvaluateDataFrameAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestEvaluateDataFrameAction.java index d2bc547b7bc20..73d2506f3713f 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestEvaluateDataFrameAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestEvaluateDataFrameAction.java @@ -21,7 +21,7 @@ public class RestEvaluateDataFrameAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(POST, MachineLearning.BASE_PATH + "data_frame/_evaluate")); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestExplainDataFrameAnalyticsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestExplainDataFrameAnalyticsAction.java index 2c371be317239..0a79085c35743 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestExplainDataFrameAnalyticsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestExplainDataFrameAnalyticsAction.java @@ -30,7 +30,7 @@ public class RestExplainDataFrameAnalyticsAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, MachineLearning.BASE_PATH + "data_frame/analytics/_explain"), new Route(POST, MachineLearning.BASE_PATH + "data_frame/analytics/_explain"), diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestGetDataFrameAnalyticsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestGetDataFrameAnalyticsAction.java index 5a6ba13533b7f..639adbc375a3a 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestGetDataFrameAnalyticsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestGetDataFrameAnalyticsAction.java @@ -25,7 +25,7 @@ public class RestGetDataFrameAnalyticsAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, MachineLearning.BASE_PATH + "data_frame/analytics"), new Route(GET, MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}"))); diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestGetDataFrameAnalyticsStatsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestGetDataFrameAnalyticsStatsAction.java index 21bee38a34336..cecad5767db99 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestGetDataFrameAnalyticsStatsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestGetDataFrameAnalyticsStatsAction.java @@ -25,7 +25,7 @@ public class RestGetDataFrameAnalyticsStatsAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, MachineLearning.BASE_PATH + "data_frame/analytics/_stats"), new Route(GET, MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}/_stats" diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestPutDataFrameAnalyticsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestPutDataFrameAnalyticsAction.java index f2764160773ef..c8983271153e6 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestPutDataFrameAnalyticsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestPutDataFrameAnalyticsAction.java @@ -23,7 +23,7 @@ public class RestPutDataFrameAnalyticsAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList( new Route(PUT, MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}")); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestStartDataFrameAnalyticsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestStartDataFrameAnalyticsAction.java index e8ee2c6fb0be4..4436fe493b2bc 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestStartDataFrameAnalyticsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestStartDataFrameAnalyticsAction.java @@ -23,7 +23,7 @@ public class RestStartDataFrameAnalyticsAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList( new Route(POST, MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}/_start" )); diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestStopDataFrameAnalyticsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestStopDataFrameAnalyticsAction.java index 38ce2954738d1..e7a1609bce944 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestStopDataFrameAnalyticsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestStopDataFrameAnalyticsAction.java @@ -22,7 +22,7 @@ public class RestStopDataFrameAnalyticsAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList( new Route(POST, MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}/_stop" )); diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestDeleteFilterAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestDeleteFilterAction.java index 4820c92e8632c..bb94ffcda4fae 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestDeleteFilterAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestDeleteFilterAction.java @@ -27,7 +27,7 @@ public class RestDeleteFilterAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestDeleteFilterAction.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestGetFiltersAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestGetFiltersAction.java index 7dc21a4bf65f3..421af0bdee60f 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestGetFiltersAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestGetFiltersAction.java @@ -30,7 +30,7 @@ public class RestGetFiltersAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestGetFiltersAction.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestPutFilterAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestPutFilterAction.java index 627947529bc59..85a01ac0edf0e 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestPutFilterAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestPutFilterAction.java @@ -28,7 +28,7 @@ public class RestPutFilterAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestPutFilterAction.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestUpdateFilterAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestUpdateFilterAction.java index 2a9607af5f557..6bf83acdc5e82 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestUpdateFilterAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestUpdateFilterAction.java @@ -28,7 +28,7 @@ public class RestUpdateFilterAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestUpdateFilterAction.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestDeleteTrainedModelAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestDeleteTrainedModelAction.java index 50394e2ae757d..e0e2b3f3d20ad 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestDeleteTrainedModelAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestDeleteTrainedModelAction.java @@ -22,7 +22,7 @@ public class RestDeleteTrainedModelAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList( new Route(DELETE, MachineLearning.BASE_PATH + "inference/{" + TrainedModelConfig.MODEL_ID.getPreferredName() + "}")); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestGetTrainedModelsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestGetTrainedModelsAction.java index f0228c892e2b7..8c783dbb609f9 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestGetTrainedModelsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestGetTrainedModelsAction.java @@ -29,7 +29,7 @@ public class RestGetTrainedModelsAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, MachineLearning.BASE_PATH + "inference/{" + TrainedModelConfig.MODEL_ID.getPreferredName() + "}"), new Route(GET, MachineLearning.BASE_PATH + "inference"))); diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestGetTrainedModelsStatsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestGetTrainedModelsStatsAction.java index 050e846adc856..a035a67022bc3 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestGetTrainedModelsStatsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestGetTrainedModelsStatsAction.java @@ -27,7 +27,7 @@ public class RestGetTrainedModelsStatsAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, MachineLearning.BASE_PATH + "inference/{" + TrainedModelConfig.MODEL_ID.getPreferredName() + "}/_stats"), new Route(GET, MachineLearning.BASE_PATH + MachineLearning.BASE_PATH + "inference/_stats"))); diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestPutTrainedModelAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestPutTrainedModelAction.java index f14228c3a5555..54f0f8476bdf4 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestPutTrainedModelAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestPutTrainedModelAction.java @@ -23,7 +23,7 @@ public class RestPutTrainedModelAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList( new Route(PUT, MachineLearning.BASE_PATH + "inference/{" + TrainedModelConfig.MODEL_ID.getPreferredName() + "}")); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestCloseJobAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestCloseJobAction.java index 36cd8198458b8..0b8ed5a9e3796 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestCloseJobAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestCloseJobAction.java @@ -29,7 +29,7 @@ public class RestCloseJobAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestCloseJobAction.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestDeleteForecastAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestDeleteForecastAction.java index ce7daad41ced3..093b062dda12b 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestDeleteForecastAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestDeleteForecastAction.java @@ -29,7 +29,7 @@ public class RestDeleteForecastAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestDeleteForecastAction.class)); @Override - public List handledRoutes() { + public List routes() { return singletonList( new Route(DELETE, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_forecast/")); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestDeleteJobAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestDeleteJobAction.java index 7ada56b25b7cf..03515a40a7cc8 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestDeleteJobAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestDeleteJobAction.java @@ -33,7 +33,7 @@ public class RestDeleteJobAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestDeleteJobAction.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestFlushJobAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestFlushJobAction.java index c105bc11ea0ca..17c3ef60144e8 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestFlushJobAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestFlushJobAction.java @@ -34,7 +34,7 @@ public class RestFlushJobAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestFlushJobAction.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestForecastJobAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestForecastJobAction.java index c144c50f74ec3..5d0aee2f4db3b 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestForecastJobAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestForecastJobAction.java @@ -28,7 +28,7 @@ public class RestForecastJobAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestForecastJobAction.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestGetJobStatsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestGetJobStatsAction.java index 21b9b72c2c104..caf3402db0615 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestGetJobStatsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestGetJobStatsAction.java @@ -30,7 +30,7 @@ public class RestGetJobStatsAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestGetJobStatsAction.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestGetJobsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestGetJobsAction.java index 3b5eb4ec58bd5..b980646a04547 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestGetJobsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestGetJobsAction.java @@ -30,7 +30,7 @@ public class RestGetJobsAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestGetJobsAction.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestOpenJobAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestOpenJobAction.java index 0f044c67853b6..21b30539ade37 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestOpenJobAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestOpenJobAction.java @@ -33,7 +33,7 @@ public class RestOpenJobAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestOpenJobAction.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPostDataAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPostDataAction.java index 0af9a7c47ef80..26d79114fa4bd 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPostDataAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPostDataAction.java @@ -30,7 +30,7 @@ public class RestPostDataAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestPostDataAction.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPostJobUpdateAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPostJobUpdateAction.java index ffa0637d6ae62..a3e69048f72cc 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPostJobUpdateAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPostJobUpdateAction.java @@ -28,7 +28,7 @@ public class RestPostJobUpdateAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestPostJobUpdateAction.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPutJobAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPutJobAction.java index 4fbfc8d2aab88..20667e299e495 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPutJobAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPutJobAction.java @@ -28,7 +28,7 @@ public class RestPutJobAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestPutJobAction.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestDeleteModelSnapshotAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestDeleteModelSnapshotAction.java index 8cb3c1c808da3..75fb5b474b513 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestDeleteModelSnapshotAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestDeleteModelSnapshotAction.java @@ -28,7 +28,7 @@ public class RestDeleteModelSnapshotAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestDeleteModelSnapshotAction.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestGetModelSnapshotsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestGetModelSnapshotsAction.java index 41da39b956b5d..24b9e32492a4e 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestGetModelSnapshotsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestGetModelSnapshotsAction.java @@ -42,7 +42,7 @@ public class RestGetModelSnapshotsAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestGetModelSnapshotsAction.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestRevertModelSnapshotAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestRevertModelSnapshotAction.java index 4f5167250e4af..2fe0c0eecd01d 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestRevertModelSnapshotAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestRevertModelSnapshotAction.java @@ -30,7 +30,7 @@ public class RestRevertModelSnapshotAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestRevertModelSnapshotAction.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestUpdateModelSnapshotAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestUpdateModelSnapshotAction.java index 9bdf2a2083f20..1a3b43a03b34b 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestUpdateModelSnapshotAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestUpdateModelSnapshotAction.java @@ -29,7 +29,7 @@ public class RestUpdateModelSnapshotAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestUpdateModelSnapshotAction.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetBucketsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetBucketsAction.java index ddda3ef19bc4f..ecf94c1fe2220 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetBucketsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetBucketsAction.java @@ -33,7 +33,7 @@ public class RestGetBucketsAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestGetBucketsAction.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetCategoriesAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetCategoriesAction.java index ce1db9d42ebe5..55a4fbffd73b7 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetCategoriesAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetCategoriesAction.java @@ -32,7 +32,7 @@ public class RestGetCategoriesAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestGetCategoriesAction.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetInfluencersAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetInfluencersAction.java index c0e1515c62c15..639ba3f17f3ec 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetInfluencersAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetInfluencersAction.java @@ -31,7 +31,7 @@ public class RestGetInfluencersAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestGetInfluencersAction.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetOverallBucketsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetOverallBucketsAction.java index 40f6fa7c72104..541fac368e17c 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetOverallBucketsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetOverallBucketsAction.java @@ -31,7 +31,7 @@ public class RestGetOverallBucketsAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestGetOverallBucketsAction.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetRecordsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetRecordsAction.java index 3318a577d7d01..738da300e7d14 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetRecordsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetRecordsAction.java @@ -31,7 +31,7 @@ public class RestGetRecordsAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestGetRecordsAction.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/validate/RestValidateDetectorAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/validate/RestValidateDetectorAction.java index f67022ef4bcd8..07dda46e4ca4b 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/validate/RestValidateDetectorAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/validate/RestValidateDetectorAction.java @@ -27,7 +27,7 @@ public class RestValidateDetectorAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestValidateDetectorAction.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/validate/RestValidateJobConfigAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/validate/RestValidateJobConfigAction.java index 4480c3fde28d6..aa96b3c591f66 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/validate/RestValidateJobConfigAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/validate/RestValidateJobConfigAction.java @@ -27,7 +27,7 @@ public class RestValidateJobConfigAction extends BaseRestHandler { new DeprecationLogger(LogManager.getLogger(RestValidateJobConfigAction.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/rest/action/RestMonitoringBulkAction.java b/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/rest/action/RestMonitoringBulkAction.java index dba11fba2cf21..1382e27c8ef13 100644 --- a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/rest/action/RestMonitoringBulkAction.java +++ b/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/rest/action/RestMonitoringBulkAction.java @@ -48,7 +48,7 @@ public class RestMonitoringBulkAction extends BaseRestHandler { MonitoredSystem.BEATS, ALL_VERSIONS); @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(POST, "/_monitoring/bulk"), new Route(PUT, "/_monitoring/bulk"))); diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestDeleteRollupJobAction.java b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestDeleteRollupJobAction.java index afadec1e580dc..e8a1d2928d72a 100644 --- a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestDeleteRollupJobAction.java +++ b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestDeleteRollupJobAction.java @@ -24,7 +24,7 @@ public class RestDeleteRollupJobAction extends BaseRestHandler { public static final ParseField ID = new ParseField("id"); @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(DELETE, "/_rollup/job/{id}")); } diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupCapsAction.java b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupCapsAction.java index b80cedf1b2789..c31a433b93ab1 100644 --- a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupCapsAction.java +++ b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupCapsAction.java @@ -23,7 +23,7 @@ public class RestGetRollupCapsAction extends BaseRestHandler { public static final ParseField ID = new ParseField("id"); @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(GET, "/_rollup/data/{id}")); } diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupIndexCapsAction.java b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupIndexCapsAction.java index 8ef597c7499f7..ed136df98b657 100644 --- a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupIndexCapsAction.java +++ b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupIndexCapsAction.java @@ -25,7 +25,7 @@ public class RestGetRollupIndexCapsAction extends BaseRestHandler { static final ParseField INDEX = new ParseField("index"); @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(GET, "/{index}/_rollup/data")); } diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupJobsAction.java b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupJobsAction.java index 8139e4fb4c251..b6d18eb83d667 100644 --- a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupJobsAction.java +++ b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupJobsAction.java @@ -23,7 +23,7 @@ public class RestGetRollupJobsAction extends BaseRestHandler { public static final ParseField ID = new ParseField("id"); @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(GET, "/_rollup/job/{id}")); } diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestPutRollupJobAction.java b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestPutRollupJobAction.java index 94c6926c3babf..f945055efd822 100644 --- a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestPutRollupJobAction.java +++ b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestPutRollupJobAction.java @@ -21,7 +21,7 @@ public class RestPutRollupJobAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(PUT, "/_rollup/job/{id}")); } diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestRollupSearchAction.java b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestRollupSearchAction.java index 87c965a2355c7..bc6e27501adc2 100644 --- a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestRollupSearchAction.java +++ b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestRollupSearchAction.java @@ -27,7 +27,7 @@ public class RestRollupSearchAction extends BaseRestHandler { private static final Set RESPONSE_PARAMS = Set.of(RestSearchAction.TYPED_KEYS_PARAM, RestSearchAction.TOTAL_HITS_AS_INT_PARAM); @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "_rollup_search"), new Route(POST, "_rollup_search"), diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestStartRollupJobAction.java b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestStartRollupJobAction.java index 03a4f0104ab06..5704e8417aead 100644 --- a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestStartRollupJobAction.java +++ b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestStartRollupJobAction.java @@ -21,7 +21,7 @@ public class RestStartRollupJobAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(POST, "/_rollup/job/{id}/_start")); } diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestStopRollupJobAction.java b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestStopRollupJobAction.java index d18bf9fd53f17..b82865d5e7246 100644 --- a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestStopRollupJobAction.java +++ b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestStopRollupJobAction.java @@ -22,7 +22,7 @@ public class RestStopRollupJobAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(POST, "/_rollup/job/{id}/_stop")); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/SecurityRestFilter.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/SecurityRestFilter.java index 3eae11bbfc94e..62cf944819a27 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/SecurityRestFilter.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/SecurityRestFilter.java @@ -93,8 +93,8 @@ public boolean allowsUnsafeBuffers() { } @Override - public List handledRoutes() { - return restHandler.handledRoutes(); + public List routes() { + return restHandler.routes(); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/RestAuthenticateAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/RestAuthenticateAction.java index d6542348b7457..33dcc311c4882 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/RestAuthenticateAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/RestAuthenticateAction.java @@ -40,7 +40,7 @@ public RestAuthenticateAction(Settings settings, SecurityContext securityContext } @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/RestDelegatePkiAuthenticationAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/RestDelegatePkiAuthenticationAction.java index 13084ae145614..4dea0899f83f2 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/RestDelegatePkiAuthenticationAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/RestDelegatePkiAuthenticationAction.java @@ -46,7 +46,7 @@ public RestDelegatePkiAuthenticationAction(Settings settings, XPackLicenseState } @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(POST, "/_security/delegate_pki")); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestCreateApiKeyAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestCreateApiKeyAction.java index 02feee31cf08d..af90797184db4 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestCreateApiKeyAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestCreateApiKeyAction.java @@ -38,7 +38,7 @@ public RestCreateApiKeyAction(Settings settings, XPackLicenseState licenseState) } @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(POST, "/_security/api_key"), new Route(PUT, "/_security/api_key"))); diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestGetApiKeyAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestGetApiKeyAction.java index 6f094128904c6..74bf64ba4daf3 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestGetApiKeyAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestGetApiKeyAction.java @@ -36,7 +36,7 @@ public RestGetApiKeyAction(Settings settings, XPackLicenseState licenseState) { } @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(GET, "/_security/api_key")); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestInvalidateApiKeyAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestInvalidateApiKeyAction.java index 03daa16b7a180..86064b953d008 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestInvalidateApiKeyAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestInvalidateApiKeyAction.java @@ -51,7 +51,7 @@ public RestInvalidateApiKeyAction(Settings settings, XPackLicenseState licenseSt } @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(DELETE, "/_security/api_key")); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oauth2/RestGetTokenAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oauth2/RestGetTokenAction.java index 6b2da8e9b5d3a..d2efb784a76ec 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oauth2/RestGetTokenAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oauth2/RestGetTokenAction.java @@ -70,7 +70,7 @@ public RestGetTokenAction(Settings settings, XPackLicenseState xPackLicenseState } @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oauth2/RestInvalidateTokenAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oauth2/RestInvalidateTokenAction.java index 7e6696c0bb472..26caf487950d1 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oauth2/RestInvalidateTokenAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oauth2/RestInvalidateTokenAction.java @@ -69,7 +69,7 @@ public RestInvalidateTokenAction(Settings settings, XPackLicenseState xPackLicen } @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oidc/RestOpenIdConnectAuthenticateAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oidc/RestOpenIdConnectAuthenticateAction.java index ea5dffbe3635c..a297b2f7cd6b5 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oidc/RestOpenIdConnectAuthenticateAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oidc/RestOpenIdConnectAuthenticateAction.java @@ -50,7 +50,7 @@ public RestOpenIdConnectAuthenticateAction(Settings settings, XPackLicenseState } @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(POST, "/_security/oidc/authenticate")); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oidc/RestOpenIdConnectLogoutAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oidc/RestOpenIdConnectLogoutAction.java index 1bcfbe750dd40..f9485f91beba2 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oidc/RestOpenIdConnectLogoutAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oidc/RestOpenIdConnectLogoutAction.java @@ -46,7 +46,7 @@ public RestOpenIdConnectLogoutAction(Settings settings, XPackLicenseState licens } @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(POST, "/_security/oidc/logout")); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oidc/RestOpenIdConnectPrepareAuthenticationAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oidc/RestOpenIdConnectPrepareAuthenticationAction.java index ad7a6bb801f95..d38febbbc33e8 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oidc/RestOpenIdConnectPrepareAuthenticationAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oidc/RestOpenIdConnectPrepareAuthenticationAction.java @@ -51,7 +51,7 @@ public RestOpenIdConnectPrepareAuthenticationAction(Settings settings, XPackLice } @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(POST, "/_security/oidc/prepare")); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestDeletePrivilegesAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestDeletePrivilegesAction.java index 27e567e7875f6..bcf9b9c09ae5d 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestDeletePrivilegesAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestDeletePrivilegesAction.java @@ -41,7 +41,7 @@ public RestDeletePrivilegesAction(Settings settings, XPackLicenseState licenseSt } @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestGetBuiltinPrivilegesAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestGetBuiltinPrivilegesAction.java index 0c754bba53285..a57b226c3156f 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestGetBuiltinPrivilegesAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestGetBuiltinPrivilegesAction.java @@ -35,7 +35,7 @@ public RestGetBuiltinPrivilegesAction(Settings settings, XPackLicenseState licen } @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(GET, "/_security/privilege/_builtin")); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestGetPrivilegesAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestGetPrivilegesAction.java index a797822a3e542..d667832c38b7f 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestGetPrivilegesAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestGetPrivilegesAction.java @@ -45,7 +45,7 @@ public RestGetPrivilegesAction(Settings settings, XPackLicenseState licenseState } @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestPutPrivilegesAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestPutPrivilegesAction.java index cd3999e6b300a..46c0ce4c744bf 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestPutPrivilegesAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestPutPrivilegesAction.java @@ -43,7 +43,7 @@ public RestPutPrivilegesAction(Settings settings, XPackLicenseState licenseState } @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/realm/RestClearRealmCacheAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/realm/RestClearRealmCacheAction.java index 035c9aa3c0766..579a98973daa4 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/realm/RestClearRealmCacheAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/realm/RestClearRealmCacheAction.java @@ -30,7 +30,7 @@ public RestClearRealmCacheAction(Settings settings, XPackLicenseState licenseSta } @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestClearRolesCacheAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestClearRolesCacheAction.java index 1ea1378014457..caaf5286b597a 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestClearRolesCacheAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestClearRolesCacheAction.java @@ -30,7 +30,7 @@ public RestClearRolesCacheAction(Settings settings, XPackLicenseState licenseSta } @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestDeleteRoleAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestDeleteRoleAction.java index cd631f126d010..0c7899309aa6b 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestDeleteRoleAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestDeleteRoleAction.java @@ -38,7 +38,7 @@ public RestDeleteRoleAction(Settings settings, XPackLicenseState licenseState) { } @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestGetRolesAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestGetRolesAction.java index aed1718c8f419..3f34b3f609312 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestGetRolesAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestGetRolesAction.java @@ -41,7 +41,7 @@ public RestGetRolesAction(Settings settings, XPackLicenseState licenseState) { } @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestPutRoleAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestPutRoleAction.java index 01379ff578a69..dd9e866029922 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestPutRoleAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestPutRoleAction.java @@ -40,7 +40,7 @@ public RestPutRoleAction(Settings settings, XPackLicenseState licenseState) { } @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/rolemapping/RestDeleteRoleMappingAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/rolemapping/RestDeleteRoleMappingAction.java index a889ae1625c58..97c134791c8ac 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/rolemapping/RestDeleteRoleMappingAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/rolemapping/RestDeleteRoleMappingAction.java @@ -39,7 +39,7 @@ public RestDeleteRoleMappingAction(Settings settings, XPackLicenseState licenseS } @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/rolemapping/RestGetRoleMappingsAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/rolemapping/RestGetRoleMappingsAction.java index 74831b725cff8..6ea486de1d760 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/rolemapping/RestGetRoleMappingsAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/rolemapping/RestGetRoleMappingsAction.java @@ -40,7 +40,7 @@ public RestGetRoleMappingsAction(Settings settings, XPackLicenseState licenseSta } @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/rolemapping/RestPutRoleMappingAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/rolemapping/RestPutRoleMappingAction.java index 1e442e31493d0..e7ce839a2c366 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/rolemapping/RestPutRoleMappingAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/rolemapping/RestPutRoleMappingAction.java @@ -42,7 +42,7 @@ public RestPutRoleMappingAction(Settings settings, XPackLicenseState licenseStat } @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/saml/RestSamlAuthenticateAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/saml/RestSamlAuthenticateAction.java index 2bee3f877d7be..6986e84464762 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/saml/RestSamlAuthenticateAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/saml/RestSamlAuthenticateAction.java @@ -67,7 +67,7 @@ public RestSamlAuthenticateAction(Settings settings, XPackLicenseState licenseSt } @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/saml/RestSamlInvalidateSessionAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/saml/RestSamlInvalidateSessionAction.java index e9301da6fb239..0d5c0e3a027db 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/saml/RestSamlInvalidateSessionAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/saml/RestSamlInvalidateSessionAction.java @@ -51,7 +51,7 @@ public RestSamlInvalidateSessionAction(Settings settings, XPackLicenseState lice } @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/saml/RestSamlLogoutAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/saml/RestSamlLogoutAction.java index 2479f8469a74c..0e947c9eb038b 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/saml/RestSamlLogoutAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/saml/RestSamlLogoutAction.java @@ -50,7 +50,7 @@ public RestSamlLogoutAction(Settings settings, XPackLicenseState licenseState) { } @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/saml/RestSamlPrepareAuthenticationAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/saml/RestSamlPrepareAuthenticationAction.java index a0fe86827b49d..13d2f771ce617 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/saml/RestSamlPrepareAuthenticationAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/saml/RestSamlPrepareAuthenticationAction.java @@ -53,7 +53,7 @@ public RestSamlPrepareAuthenticationAction(Settings settings, XPackLicenseState } @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestChangePasswordAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestChangePasswordAction.java index 08f8224073d47..fb185dc963dba 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestChangePasswordAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestChangePasswordAction.java @@ -48,7 +48,7 @@ public RestChangePasswordAction(Settings settings, SecurityContext securityConte } @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestDeleteUserAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestDeleteUserAction.java index 0544cde8c583d..1b18f2f08591d 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestDeleteUserAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestDeleteUserAction.java @@ -38,7 +38,7 @@ public RestDeleteUserAction(Settings settings, XPackLicenseState licenseState) { } @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestGetUserPrivilegesAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestGetUserPrivilegesAction.java index a25c76c83bc5d..3c8db810f45ad 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestGetUserPrivilegesAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestGetUserPrivilegesAction.java @@ -49,7 +49,7 @@ public RestGetUserPrivilegesAction(Settings settings, SecurityContext securityCo } @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestGetUsersAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestGetUsersAction.java index a06f4ad836cf1..3dbe2823416b8 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestGetUsersAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestGetUsersAction.java @@ -41,7 +41,7 @@ public RestGetUsersAction(Settings settings, XPackLicenseState licenseState) { } @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestHasPrivilegesAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestHasPrivilegesAction.java index 0c6fabbb5c332..ed4cfa3a00d17 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestHasPrivilegesAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestHasPrivilegesAction.java @@ -51,7 +51,7 @@ public RestHasPrivilegesAction(Settings settings, SecurityContext securityContex } @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestPutUserAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestPutUserAction.java index 5e17552ab6d33..6fa47e73feb0c 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestPutUserAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestPutUserAction.java @@ -47,7 +47,7 @@ public RestPutUserAction(Settings settings, XPackLicenseState licenseState) { } @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestSetEnabledAction.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestSetEnabledAction.java index b818a69384757..5eadd3b8ec9cb 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestSetEnabledAction.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestSetEnabledAction.java @@ -41,7 +41,7 @@ public RestSetEnabledAction(Settings settings, XPackLicenseState licenseState) { } @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/rest/action/SecurityBaseRestHandlerTests.java b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/rest/action/SecurityBaseRestHandlerTests.java index f0557fd68a079..0000616002411 100644 --- a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/rest/action/SecurityBaseRestHandlerTests.java +++ b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/rest/action/SecurityBaseRestHandlerTests.java @@ -42,7 +42,7 @@ public String getName() { } @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/rest/action/saml/SamlBaseRestHandlerTests.java b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/rest/action/saml/SamlBaseRestHandlerTests.java index 4035ff0a8d16b..08aac95ce38a3 100644 --- a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/rest/action/saml/SamlBaseRestHandlerTests.java +++ b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/rest/action/saml/SamlBaseRestHandlerTests.java @@ -54,7 +54,7 @@ public String getName() { } @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlClearCursorAction.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlClearCursorAction.java index 0c78c12f6a1d6..b9d8c94c76abf 100644 --- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlClearCursorAction.java +++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlClearCursorAction.java @@ -24,7 +24,7 @@ public class RestSqlClearCursorAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(POST, Protocol.CLEAR_CURSOR_REST_ENDPOINT)); } diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlQueryAction.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlQueryAction.java index 929a129455061..c5af7b3a86c02 100644 --- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlQueryAction.java +++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlQueryAction.java @@ -34,7 +34,7 @@ public class RestSqlQueryAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, Protocol.SQL_QUERY_REST_ENDPOINT), new Route(POST, Protocol.SQL_QUERY_REST_ENDPOINT))); diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlStatsAction.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlStatsAction.java index d0a5977ef9c6f..01c3ec8be9e05 100644 --- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlStatsAction.java +++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlStatsAction.java @@ -20,7 +20,7 @@ public class RestSqlStatsAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(GET, Protocol.SQL_STATS_REST_ENDPOINT)); } diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlTranslateAction.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlTranslateAction.java index 72371f55b1637..d059055feb22b 100644 --- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlTranslateAction.java +++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlTranslateAction.java @@ -28,7 +28,7 @@ public class RestSqlTranslateAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, Protocol.SQL_TRANSLATE_REST_ENDPOINT), new Route(POST, Protocol.SQL_TRANSLATE_REST_ENDPOINT))); diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestDeleteTransformAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestDeleteTransformAction.java index 6b3c990cec977..da60f8e040ee1 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestDeleteTransformAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestDeleteTransformAction.java @@ -21,7 +21,7 @@ public class RestDeleteTransformAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(DELETE, TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID)); } diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestGetTransformAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestGetTransformAction.java index 2b7f41cdf6742..58670d10dce2a 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestGetTransformAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestGetTransformAction.java @@ -24,7 +24,7 @@ public class RestGetTransformAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, TransformField.REST_BASE_PATH_TRANSFORMS), new Route(GET, TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID))); diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestGetTransformStatsAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestGetTransformStatsAction.java index dc493349a7145..fa4d2364437f8 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestGetTransformStatsAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestGetTransformStatsAction.java @@ -24,7 +24,7 @@ public class RestGetTransformStatsAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, TransformField.REST_BASE_PATH_TRANSFORMS + "_stats"), new Route(GET, TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID + "_stats"))); diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestPreviewTransformAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestPreviewTransformAction.java index 0a48d4c20bf72..f5c0fe1808c24 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestPreviewTransformAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestPreviewTransformAction.java @@ -23,7 +23,7 @@ public class RestPreviewTransformAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(POST, TransformField.REST_BASE_PATH_TRANSFORMS + "_preview")); } diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestPutTransformAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestPutTransformAction.java index 923c53395c29a..06bb43ee3cd80 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestPutTransformAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestPutTransformAction.java @@ -23,7 +23,7 @@ public class RestPutTransformAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(PUT, TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID)); } diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestStartTransformAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestStartTransformAction.java index eff6c6a5b387b..bf791c2179103 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestStartTransformAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestStartTransformAction.java @@ -22,7 +22,7 @@ public class RestStartTransformAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(POST, TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID + "_start")); } diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestStopTransformAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestStopTransformAction.java index 9cbc259e8be20..4ed3f03648ccb 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestStopTransformAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestStopTransformAction.java @@ -21,7 +21,7 @@ public class RestStopTransformAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(POST, TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID + "_stop")); } diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestUpdateTransformAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestUpdateTransformAction.java index e190e16db14a5..08ac7566ff469 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestUpdateTransformAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestUpdateTransformAction.java @@ -23,7 +23,7 @@ public class RestUpdateTransformAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(POST, TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID + "_update")); } diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestDeleteTransformActionDeprecated.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestDeleteTransformActionDeprecated.java index ed4398f673c49..7340c65811655 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestDeleteTransformActionDeprecated.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestDeleteTransformActionDeprecated.java @@ -29,7 +29,7 @@ public class RestDeleteTransformActionDeprecated extends BaseRestHandler { LogManager.getLogger(RestDeleteTransformActionDeprecated.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestGetTransformActionDeprecated.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestGetTransformActionDeprecated.java index eb9af9e0b8fc4..0f47320688dfa 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestGetTransformActionDeprecated.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestGetTransformActionDeprecated.java @@ -32,7 +32,7 @@ public class RestGetTransformActionDeprecated extends BaseRestHandler { LogManager.getLogger(RestGetTransformActionDeprecated.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestGetTransformStatsActionDeprecated.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestGetTransformStatsActionDeprecated.java index d6e5442d19ef5..9b34769ca0e6b 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestGetTransformStatsActionDeprecated.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestGetTransformStatsActionDeprecated.java @@ -32,7 +32,7 @@ public class RestGetTransformStatsActionDeprecated extends BaseRestHandler { LogManager.getLogger(RestGetTransformStatsActionDeprecated.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestPreviewTransformActionDeprecated.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestPreviewTransformActionDeprecated.java index a58b248f6777f..97f66c29c2726 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestPreviewTransformActionDeprecated.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestPreviewTransformActionDeprecated.java @@ -31,7 +31,7 @@ public class RestPreviewTransformActionDeprecated extends BaseRestHandler { LogManager.getLogger(RestPreviewTransformActionDeprecated.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestPutTransformActionDeprecated.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestPutTransformActionDeprecated.java index 2d24c06e17106..9ceb7da78a704 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestPutTransformActionDeprecated.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestPutTransformActionDeprecated.java @@ -31,7 +31,7 @@ public class RestPutTransformActionDeprecated extends BaseRestHandler { LogManager.getLogger(RestPutTransformActionDeprecated.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestStartTransformActionDeprecated.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestStartTransformActionDeprecated.java index 9e5bbef2dc151..322b5f3eb4501 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestStartTransformActionDeprecated.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestStartTransformActionDeprecated.java @@ -30,7 +30,7 @@ public class RestStartTransformActionDeprecated extends BaseRestHandler { LogManager.getLogger(RestStartTransformActionDeprecated.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestStopTransformActionDeprecated.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestStopTransformActionDeprecated.java index ad9b6d8509449..b308fc98015fb 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestStopTransformActionDeprecated.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestStopTransformActionDeprecated.java @@ -29,7 +29,7 @@ public class RestStopTransformActionDeprecated extends BaseRestHandler { LogManager.getLogger(RestStopTransformActionDeprecated.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestUpdateTransformActionDeprecated.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestUpdateTransformActionDeprecated.java index 7c30217bddf03..ff9752f7767d4 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestUpdateTransformActionDeprecated.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/compat/RestUpdateTransformActionDeprecated.java @@ -31,7 +31,7 @@ public class RestUpdateTransformActionDeprecated extends BaseRestHandler { LogManager.getLogger(RestUpdateTransformActionDeprecated.class)); @Override - public List handledRoutes() { + public List routes() { return Collections.emptyList(); } diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestAckWatchAction.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestAckWatchAction.java index fd294f1389077..5ce678ac33ab9 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestAckWatchAction.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestAckWatchAction.java @@ -33,7 +33,7 @@ public class RestAckWatchAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(POST, "/_watcher/watch/{id}/_ack"), new Route(PUT, "/_watcher/watch/{id}/_ack"), diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestActivateWatchAction.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestActivateWatchAction.java index 161a3b519c183..7bfdb5e726c88 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestActivateWatchAction.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestActivateWatchAction.java @@ -33,7 +33,7 @@ public class RestActivateWatchAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(POST, "/_watcher/watch/{id}/_activate"), new Route(PUT, "/_watcher/watch/{id}/_activate"))); @@ -62,7 +62,7 @@ public RestResponse buildResponse(ActivateWatchResponse response, XContentBuilde public static class DeactivateRestHandler extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(POST, "/_watcher/watch/{id}/_deactivate"), new Route(PUT, "/_watcher/watch/{id}/_deactivate"))); diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestDeleteWatchAction.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestDeleteWatchAction.java index 171bad825cb84..332fb8140aa35 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestDeleteWatchAction.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestDeleteWatchAction.java @@ -28,7 +28,7 @@ public class RestDeleteWatchAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(DELETE, "/_watcher/watch/{id}")); } diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestExecuteWatchAction.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestExecuteWatchAction.java index ab56f87bc6100..14e841d23e857 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestExecuteWatchAction.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestExecuteWatchAction.java @@ -49,7 +49,7 @@ public class RestExecuteWatchAction extends BaseRestHandler implements RestReque WatchField.METADATA.getPreferredName(), WatchField.STATUS.getPreferredName()); @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(POST, "/_watcher/watch/{id}/_execute"), new Route(PUT, "/_watcher/watch/{id}/_execute"), diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestGetWatchAction.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestGetWatchAction.java index 65fc95285c129..0a3a4f576dae1 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestGetWatchAction.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestGetWatchAction.java @@ -28,7 +28,7 @@ public class RestGetWatchAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(GET, "/_watcher/watch/{id}")); } diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestPutWatchAction.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestPutWatchAction.java index 39b599d513f69..5cf1ca6ee4c30 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestPutWatchAction.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestPutWatchAction.java @@ -35,7 +35,7 @@ public class RestPutWatchAction extends BaseRestHandler implements RestRequestFilter { @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(POST, "/_watcher/watch/{id}"), new Route(PUT, "/_watcher/watch/{id}"))); diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatchServiceAction.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatchServiceAction.java index c50ad989eab54..991b724694129 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatchServiceAction.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatchServiceAction.java @@ -21,7 +21,7 @@ public class RestWatchServiceAction extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(POST, "/_watcher/_start")); } @@ -39,7 +39,7 @@ public RestChannelConsumer prepareRequest(RestRequest request, NodeClient client public static class StopRestHandler extends BaseRestHandler { @Override - public List handledRoutes() { + public List routes() { return singletonList(new Route(POST, "/_watcher/_stop")); } diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatcherStatsAction.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatcherStatsAction.java index ba55822108c02..2c3319b92c981 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatcherStatsAction.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatcherStatsAction.java @@ -30,7 +30,7 @@ public class RestWatcherStatsAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(logger); @Override - public List handledRoutes() { + public List routes() { return unmodifiableList(asList( new Route(GET, "/_watcher/stats"), new Route(GET, "/_watcher/stats/{metric}"))); From e40372a166091b9524e10c710c59e1ef7c60404d Mon Sep 17 00:00:00 2001 From: jaymode Date: Fri, 7 Feb 2020 09:52:19 -0700 Subject: [PATCH 10/11] checkstyle --- .../dataframe/RestExplainDataFrameAnalyticsAction.java | 8 ++++---- .../dataframe/RestGetDataFrameAnalyticsStatsAction.java | 4 ++-- .../rest/dataframe/RestStartDataFrameAnalyticsAction.java | 4 ++-- .../rest/dataframe/RestStopDataFrameAnalyticsAction.java | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestExplainDataFrameAnalyticsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestExplainDataFrameAnalyticsAction.java index 0a79085c35743..1d5f99aaf10c7 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestExplainDataFrameAnalyticsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestExplainDataFrameAnalyticsAction.java @@ -34,10 +34,10 @@ public List routes() { return unmodifiableList(asList( new Route(GET, MachineLearning.BASE_PATH + "data_frame/analytics/_explain"), new Route(POST, MachineLearning.BASE_PATH + "data_frame/analytics/_explain"), - new Route(GET, MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}/_explain" - ), - new Route(POST, MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}/_explain" - ))); + new Route( + GET, MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}/_explain"), + new Route(POST, + MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}/_explain"))); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestGetDataFrameAnalyticsStatsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestGetDataFrameAnalyticsStatsAction.java index cecad5767db99..793f41796cc5f 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestGetDataFrameAnalyticsStatsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestGetDataFrameAnalyticsStatsAction.java @@ -28,8 +28,8 @@ public class RestGetDataFrameAnalyticsStatsAction extends BaseRestHandler { public List routes() { return unmodifiableList(asList( new Route(GET, MachineLearning.BASE_PATH + "data_frame/analytics/_stats"), - new Route(GET, MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}/_stats" - ))); + new Route( + GET, MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}/_stats"))); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestStartDataFrameAnalyticsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestStartDataFrameAnalyticsAction.java index 4436fe493b2bc..9bc6ad6b4ea07 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestStartDataFrameAnalyticsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestStartDataFrameAnalyticsAction.java @@ -25,8 +25,8 @@ public class RestStartDataFrameAnalyticsAction extends BaseRestHandler { @Override public List routes() { return singletonList( - new Route(POST, MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}/_start" - )); + new Route( + POST, MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}/_start")); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestStopDataFrameAnalyticsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestStopDataFrameAnalyticsAction.java index e7a1609bce944..2787aad91579a 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestStopDataFrameAnalyticsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestStopDataFrameAnalyticsAction.java @@ -24,8 +24,8 @@ public class RestStopDataFrameAnalyticsAction extends BaseRestHandler { @Override public List routes() { return singletonList( - new Route(POST, MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}/_stop" - )); + new Route( + POST, MachineLearning.BASE_PATH + "data_frame/analytics/{" + DataFrameAnalyticsConfig.ID.getPreferredName() + "}/_stop")); } @Override From bda4cc54519bd20973291b91d34612d669b0d358 Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Sun, 9 Feb 2020 09:10:43 -0500 Subject: [PATCH 11/11] Fix imports --- .../autoscaling/rest/RestGetAutoscalingDecisionHandler.java | 1 - 1 file changed, 1 deletion(-) diff --git a/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/rest/RestGetAutoscalingDecisionHandler.java b/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/rest/RestGetAutoscalingDecisionHandler.java index fa1164eebb6c2..aeef9884295d7 100644 --- a/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/rest/RestGetAutoscalingDecisionHandler.java +++ b/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/rest/RestGetAutoscalingDecisionHandler.java @@ -14,7 +14,6 @@ import java.util.List; -import static java.util.Collections.singletonList; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestGetAutoscalingDecisionHandler extends BaseRestHandler {