From a4cccdcc7d98f1716be877473f5c94024edb5c50 Mon Sep 17 00:00:00 2001 From: Dennis Toepker Date: Thu, 30 Apr 2026 13:36:44 -0700 Subject: [PATCH] small fix to keep alerting builds stable post ppl alerting common utils PR Signed-off-by: Dennis Toepker --- .../alerting/resthandler/RestIndexMonitorAction.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/resthandler/RestIndexMonitorAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/resthandler/RestIndexMonitorAction.kt index 5f753edd1..b903930f4 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/resthandler/RestIndexMonitorAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/resthandler/RestIndexMonitorAction.kt @@ -18,6 +18,7 @@ import org.opensearch.commons.alerting.model.BucketLevelTrigger import org.opensearch.commons.alerting.model.DocLevelMonitorInput import org.opensearch.commons.alerting.model.DocumentLevelTrigger import org.opensearch.commons.alerting.model.Monitor +import org.opensearch.commons.alerting.model.PPLTrigger import org.opensearch.commons.alerting.model.QueryLevelTrigger import org.opensearch.commons.alerting.model.ScheduledJob import org.opensearch.commons.alerting.util.AlertingException @@ -30,7 +31,6 @@ import org.opensearch.core.xcontent.XContentParser.Token import org.opensearch.core.xcontent.XContentParserUtils.ensureExpectedToken import org.opensearch.index.seqno.SequenceNumbers import org.opensearch.rest.BaseRestHandler -import org.opensearch.rest.BaseRestHandler.RestChannelConsumer import org.opensearch.rest.BytesRestResponse import org.opensearch.rest.RestChannel import org.opensearch.rest.RestHandler.ReplacedRoute @@ -135,6 +135,14 @@ class RestIndexMonitorAction : BaseRestHandler() { } } } + + Monitor.MonitorType.PPL_MONITOR -> { + triggers.forEach { + if (it !is PPLTrigger) { + throw IllegalArgumentException("Illegal trigger type, ${it.javaClass.name}, for PPL monitor") + } + } + } } } } catch (e: Exception) {