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