|
| 1 | +/* |
| 2 | + * SPDX-License-Identifier: Apache-2.0 |
| 3 | + * |
| 4 | + * The OpenSearch Contributors require contributions made to |
| 5 | + * this file be licensed under the Apache-2.0 license or a |
| 6 | + * compatible open source license. |
| 7 | + */ |
| 8 | + |
| 9 | +package org.opensearch.plugin.wlm; |
| 10 | + |
| 11 | +import org.opensearch.action.ActionRequest; |
| 12 | +import org.opensearch.cluster.metadata.IndexNameExpressionResolver; |
| 13 | +import org.opensearch.cluster.node.DiscoveryNodes; |
| 14 | +import org.opensearch.common.settings.ClusterSettings; |
| 15 | +import org.opensearch.common.settings.IndexScopedSettings; |
| 16 | +import org.opensearch.common.settings.Setting; |
| 17 | +import org.opensearch.common.settings.Settings; |
| 18 | +import org.opensearch.common.settings.SettingsFilter; |
| 19 | +import org.opensearch.core.action.ActionResponse; |
| 20 | +import org.opensearch.plugin.wlm.action.CreateQueryGroupAction; |
| 21 | +import org.opensearch.plugin.wlm.action.TransportCreateQueryGroupAction; |
| 22 | +import org.opensearch.plugin.wlm.rest.RestCreateQueryGroupAction; |
| 23 | +import org.opensearch.plugin.wlm.service.QueryGroupPersistenceService; |
| 24 | +import org.opensearch.plugins.ActionPlugin; |
| 25 | +import org.opensearch.plugins.Plugin; |
| 26 | +import org.opensearch.rest.RestController; |
| 27 | +import org.opensearch.rest.RestHandler; |
| 28 | + |
| 29 | +import java.util.List; |
| 30 | +import java.util.function.Supplier; |
| 31 | + |
| 32 | +/** |
| 33 | + * Plugin class for WorkloadManagement |
| 34 | + */ |
| 35 | +public class WorkloadManagementPlugin extends Plugin implements ActionPlugin { |
| 36 | + |
| 37 | + /** |
| 38 | + * Default constructor |
| 39 | + */ |
| 40 | + public WorkloadManagementPlugin() {} |
| 41 | + |
| 42 | + @Override |
| 43 | + public List<ActionHandler<? extends ActionRequest, ? extends ActionResponse>> getActions() { |
| 44 | + return List.of(new ActionPlugin.ActionHandler<>(CreateQueryGroupAction.INSTANCE, TransportCreateQueryGroupAction.class)); |
| 45 | + } |
| 46 | + |
| 47 | + @Override |
| 48 | + public List<RestHandler> getRestHandlers( |
| 49 | + Settings settings, |
| 50 | + RestController restController, |
| 51 | + ClusterSettings clusterSettings, |
| 52 | + IndexScopedSettings indexScopedSettings, |
| 53 | + SettingsFilter settingsFilter, |
| 54 | + IndexNameExpressionResolver indexNameExpressionResolver, |
| 55 | + Supplier<DiscoveryNodes> nodesInCluster |
| 56 | + ) { |
| 57 | + return List.of(new RestCreateQueryGroupAction()); |
| 58 | + } |
| 59 | + |
| 60 | + @Override |
| 61 | + public List<Setting<?>> getSettings() { |
| 62 | + return List.of(QueryGroupPersistenceService.MAX_QUERY_GROUP_COUNT); |
| 63 | + } |
| 64 | +} |
0 commit comments