@@ -16,6 +16,7 @@ import org.opensearch.alerting.action.GetRemoteIndexesAction
16
16
import org.opensearch.alerting.action.SearchEmailAccountAction
17
17
import org.opensearch.alerting.action.SearchEmailGroupAction
18
18
import org.opensearch.alerting.alerts.AlertIndices
19
+ import org.opensearch.alerting.alerts.AlertIndices.Companion.ALL_ALERT_INDEX_PATTERN
19
20
import org.opensearch.alerting.comments.CommentsIndices
20
21
import org.opensearch.alerting.core.JobSweeper
21
22
import org.opensearch.alerting.core.ScheduledJobIndices
@@ -101,6 +102,7 @@ import org.opensearch.commons.alerting.model.DocumentLevelTrigger
101
102
import org.opensearch.commons.alerting.model.Monitor
102
103
import org.opensearch.commons.alerting.model.QueryLevelTrigger
103
104
import org.opensearch.commons.alerting.model.ScheduledJob
105
+ import org.opensearch.commons.alerting.model.ScheduledJob.Companion.SCHEDULED_JOBS_INDEX
104
106
import org.opensearch.commons.alerting.model.SearchInput
105
107
import org.opensearch.commons.alerting.model.Workflow
106
108
import org.opensearch.core.action.ActionResponse
@@ -111,6 +113,7 @@ import org.opensearch.core.xcontent.XContentParser
111
113
import org.opensearch.env.Environment
112
114
import org.opensearch.env.NodeEnvironment
113
115
import org.opensearch.index.IndexModule
116
+ import org.opensearch.indices.SystemIndexDescriptor
114
117
import org.opensearch.monitor.jvm.JvmStats
115
118
import org.opensearch.painless.spi.PainlessExtension
116
119
import org.opensearch.painless.spi.Whitelist
@@ -120,6 +123,7 @@ import org.opensearch.plugins.ActionPlugin
120
123
import org.opensearch.plugins.ReloadablePlugin
121
124
import org.opensearch.plugins.ScriptPlugin
122
125
import org.opensearch.plugins.SearchPlugin
126
+ import org.opensearch.plugins.SystemIndexPlugin
123
127
import org.opensearch.repositories.RepositoriesService
124
128
import org.opensearch.rest.RestController
125
129
import org.opensearch.rest.RestHandler
@@ -135,7 +139,8 @@ import java.util.function.Supplier
135
139
* It also adds [Monitor.XCONTENT_REGISTRY], [SearchInput.XCONTENT_REGISTRY], [QueryLevelTrigger.XCONTENT_REGISTRY],
136
140
* [BucketLevelTrigger.XCONTENT_REGISTRY], [ClusterMetricsInput.XCONTENT_REGISTRY] to the [NamedXContentRegistry] so that we are able to deserialize the custom named objects.
137
141
*/
138
- internal class AlertingPlugin : PainlessExtension , ActionPlugin , ScriptPlugin , ReloadablePlugin , SearchPlugin , PercolatorPluginExt () {
142
+ internal class AlertingPlugin : PainlessExtension , ActionPlugin , ScriptPlugin , ReloadablePlugin ,
143
+ SearchPlugin , SystemIndexPlugin , PercolatorPluginExt () {
139
144
140
145
override fun getContextWhitelists (): Map <ScriptContext <* >, List<Whitelist>> {
141
146
val whitelist = WhitelistLoader .loadFromResourceFiles(javaClass, " org.opensearch.alerting.txt" )
@@ -428,6 +433,13 @@ internal class AlertingPlugin : PainlessExtension, ActionPlugin, ScriptPlugin, R
428
433
return listOf (TriggerScript .CONTEXT )
429
434
}
430
435
436
+ override fun getSystemIndexDescriptors (settings : Settings ): Collection <SystemIndexDescriptor > {
437
+ return listOf (
438
+ SystemIndexDescriptor (ALL_ALERT_INDEX_PATTERN , " Alerting Plugin system index pattern" ),
439
+ SystemIndexDescriptor (SCHEDULED_JOBS_INDEX , " Alerting Plugin Configuration index" )
440
+ )
441
+ }
442
+
431
443
override fun reload (settings : Settings ) {
432
444
runner.reloadDestinationSettings(settings)
433
445
}
0 commit comments