Skip to content

Commit db57bcb

Browse files
committed
add get rule api logic
Signed-off-by: Ruirui Zhang <mariazrr@amazon.com>
1 parent 34ef146 commit db57bcb

File tree

55 files changed

+1545
-85
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1545
-85
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
2020
- Add vertical scaling and SoftReference for snapshot repository data cache ([#16489](https://github.com/opensearch-project/OpenSearch/pull/16489))
2121
- [Workload Management] Add Workload Management IT ([#16359](https://github.com/opensearch-project/OpenSearch/pull/16359))
2222
- Support prefix list for remote repository attributes([#16271](https://github.com/opensearch-project/OpenSearch/pull/16271))
23+
- Add create rule api logic for rule-based auto tagging ([#17336](https://github.com/opensearch-project/OpenSearch/pull/17336))
2324
- Add new configuration setting `synonym_analyzer`, to the `synonym` and `synonym_graph` filters, enabling the specification of a custom analyzer for reading the synonym file ([#16488](https://github.com/opensearch-project/OpenSearch/pull/16488)).
2425
- Add stats for remote publication failure and move download failure stats to remote methods([#16682](https://github.com/opensearch-project/OpenSearch/pull/16682/))
2526
- Update script supports java.lang.String.sha1() and java.lang.String.sha256() methods ([#16923](https://github.com/opensearch-project/OpenSearch/pull/16923))

plugins/workload-management/src/main/java/org/opensearch/plugin/wlm/WorkloadManagementPlugin.java

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,32 +18,39 @@
1818
import org.opensearch.common.settings.Settings;
1919
import org.opensearch.common.settings.SettingsFilter;
2020
import org.opensearch.core.action.ActionResponse;
21-
import org.opensearch.plugin.wlm.action.CreateQueryGroupAction;
22-
import org.opensearch.plugin.wlm.action.DeleteQueryGroupAction;
23-
import org.opensearch.plugin.wlm.action.GetQueryGroupAction;
24-
import org.opensearch.plugin.wlm.action.TransportCreateQueryGroupAction;
25-
import org.opensearch.plugin.wlm.action.TransportDeleteQueryGroupAction;
26-
import org.opensearch.plugin.wlm.action.TransportGetQueryGroupAction;
27-
import org.opensearch.plugin.wlm.action.TransportUpdateQueryGroupAction;
28-
import org.opensearch.plugin.wlm.action.UpdateQueryGroupAction;
29-
import org.opensearch.plugin.wlm.rest.RestCreateQueryGroupAction;
30-
import org.opensearch.plugin.wlm.rest.RestDeleteQueryGroupAction;
31-
import org.opensearch.plugin.wlm.rest.RestGetQueryGroupAction;
32-
import org.opensearch.plugin.wlm.rest.RestUpdateQueryGroupAction;
33-
import org.opensearch.plugin.wlm.service.QueryGroupPersistenceService;
21+
import org.opensearch.indices.SystemIndexDescriptor;
22+
import org.opensearch.plugin.wlm.querygroup.action.CreateQueryGroupAction;
23+
import org.opensearch.plugin.wlm.querygroup.action.DeleteQueryGroupAction;
24+
import org.opensearch.plugin.wlm.querygroup.action.GetQueryGroupAction;
25+
import org.opensearch.plugin.wlm.querygroup.action.TransportCreateQueryGroupAction;
26+
import org.opensearch.plugin.wlm.querygroup.action.TransportDeleteQueryGroupAction;
27+
import org.opensearch.plugin.wlm.querygroup.action.TransportGetQueryGroupAction;
28+
import org.opensearch.plugin.wlm.querygroup.action.TransportUpdateQueryGroupAction;
29+
import org.opensearch.plugin.wlm.querygroup.action.UpdateQueryGroupAction;
30+
import org.opensearch.plugin.wlm.querygroup.rest.RestCreateQueryGroupAction;
31+
import org.opensearch.plugin.wlm.querygroup.rest.RestDeleteQueryGroupAction;
32+
import org.opensearch.plugin.wlm.querygroup.rest.RestGetQueryGroupAction;
33+
import org.opensearch.plugin.wlm.querygroup.rest.RestUpdateQueryGroupAction;
34+
import org.opensearch.plugin.wlm.querygroup.service.QueryGroupPersistenceService;
35+
import org.opensearch.plugin.wlm.rule.action.GetRuleAction;
36+
import org.opensearch.plugin.wlm.rule.action.TransportGetRuleAction;
37+
import org.opensearch.plugin.wlm.rule.rest.RestGetRuleAction;
3438
import org.opensearch.plugins.ActionPlugin;
3539
import org.opensearch.plugins.Plugin;
40+
import org.opensearch.plugins.SystemIndexPlugin;
3641
import org.opensearch.rest.RestController;
3742
import org.opensearch.rest.RestHandler;
3843

3944
import java.util.Collection;
4045
import java.util.List;
4146
import java.util.function.Supplier;
4247

48+
import static org.opensearch.plugin.wlm.rule.service.RulePersistenceService.RULE_INDEX;
49+
4350
/**
4451
* Plugin class for WorkloadManagement
4552
*/
46-
public class WorkloadManagementPlugin extends Plugin implements ActionPlugin {
53+
public class WorkloadManagementPlugin extends Plugin implements ActionPlugin, SystemIndexPlugin {
4754

4855
/**
4956
* Default constructor
@@ -56,10 +63,16 @@ public WorkloadManagementPlugin() {}
5663
new ActionPlugin.ActionHandler<>(CreateQueryGroupAction.INSTANCE, TransportCreateQueryGroupAction.class),
5764
new ActionPlugin.ActionHandler<>(GetQueryGroupAction.INSTANCE, TransportGetQueryGroupAction.class),
5865
new ActionPlugin.ActionHandler<>(DeleteQueryGroupAction.INSTANCE, TransportDeleteQueryGroupAction.class),
59-
new ActionPlugin.ActionHandler<>(UpdateQueryGroupAction.INSTANCE, TransportUpdateQueryGroupAction.class)
66+
new ActionPlugin.ActionHandler<>(UpdateQueryGroupAction.INSTANCE, TransportUpdateQueryGroupAction.class),
67+
new ActionPlugin.ActionHandler<>(GetRuleAction.INSTANCE, TransportGetRuleAction.class)
6068
);
6169
}
6270

71+
@Override
72+
public Collection<SystemIndexDescriptor> getSystemIndexDescriptors(Settings settings) {
73+
return List.of(new SystemIndexDescriptor(RULE_INDEX, "System index used for storing rules"));
74+
}
75+
6376
@Override
6477
public List<RestHandler> getRestHandlers(
6578
Settings settings,
@@ -74,7 +87,8 @@ public List<RestHandler> getRestHandlers(
7487
new RestCreateQueryGroupAction(),
7588
new RestGetQueryGroupAction(),
7689
new RestDeleteQueryGroupAction(),
77-
new RestUpdateQueryGroupAction()
90+
new RestUpdateQueryGroupAction(),
91+
new RestGetRuleAction()
7892
);
7993
}
8094

plugins/workload-management/src/main/java/org/opensearch/plugin/wlm/WorkloadManagementPluginModule.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
import org.opensearch.common.inject.AbstractModule;
1212
import org.opensearch.common.inject.Singleton;
13-
import org.opensearch.plugin.wlm.service.QueryGroupPersistenceService;
13+
import org.opensearch.plugin.wlm.querygroup.service.QueryGroupPersistenceService;
1414

1515
/**
1616
* Guice Module to manage WorkloadManagement related objects
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* compatible open source license.
77
*/
88

9-
package org.opensearch.plugin.wlm.action;
9+
package org.opensearch.plugin.wlm.querygroup.action;
1010

1111
import org.opensearch.action.ActionType;
1212

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* compatible open source license.
77
*/
88

9-
package org.opensearch.plugin.wlm.action;
9+
package org.opensearch.plugin.wlm.querygroup.action;
1010

1111
import org.opensearch.action.ActionRequestValidationException;
1212
import org.opensearch.action.support.clustermanager.ClusterManagerNodeRequest;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* compatible open source license.
77
*/
88

9-
package org.opensearch.plugin.wlm.action;
9+
package org.opensearch.plugin.wlm.querygroup.action;
1010

1111
import org.opensearch.cluster.metadata.QueryGroup;
1212
import org.opensearch.core.action.ActionResponse;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* compatible open source license.
77
*/
88

9-
package org.opensearch.plugin.wlm.action;
9+
package org.opensearch.plugin.wlm.querygroup.action;
1010

1111
import org.opensearch.action.ActionType;
1212
import org.opensearch.action.support.master.AcknowledgedResponse;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* compatible open source license.
77
*/
88

9-
package org.opensearch.plugin.wlm.action;
9+
package org.opensearch.plugin.wlm.querygroup.action;
1010

1111
import org.opensearch.action.ActionRequestValidationException;
1212
import org.opensearch.action.support.master.AcknowledgedRequest;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* compatible open source license.
77
*/
88

9-
package org.opensearch.plugin.wlm.action;
9+
package org.opensearch.plugin.wlm.querygroup.action;
1010

1111
import org.opensearch.action.ActionType;
1212

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* compatible open source license.
77
*/
88

9-
package org.opensearch.plugin.wlm.action;
9+
package org.opensearch.plugin.wlm.querygroup.action;
1010

1111
import org.opensearch.action.ActionRequestValidationException;
1212
import org.opensearch.action.support.clustermanager.ClusterManagerNodeReadRequest;

0 commit comments

Comments
 (0)