|
1 | 1 | package org.opensearch.alerting.core.modelv2 |
2 | 2 |
|
| 3 | +import org.opensearch.alerting.core.modelv2.MonitorV2.Companion.NO_ID |
| 4 | +import org.opensearch.alerting.core.modelv2.MonitorV2.Companion.NO_VERSION |
3 | 5 | import org.opensearch.alerting.core.util.nonOptionalTimeField |
4 | 6 | import org.opensearch.common.unit.TimeValue |
5 | 7 | import org.opensearch.commons.alerting.model.CronSchedule |
6 | | -import org.opensearch.commons.alerting.model.IntervalSchedule |
7 | | -import org.opensearch.commons.alerting.model.Monitor |
| 8 | +import org.opensearch.commons.alerting.model.Monitor.Companion.SCHEMA_VERSION_FIELD |
8 | 9 | import org.opensearch.commons.alerting.model.Schedule |
9 | 10 | import org.opensearch.commons.alerting.util.IndexUtils |
10 | 11 | import org.opensearch.commons.alerting.util.instant |
@@ -41,8 +42,8 @@ import java.time.Instant |
41 | 42 | * @property query The PPL query string to be executed by this monitor. |
42 | 43 | */ |
43 | 44 | data class PPLMonitor( |
44 | | - override val id: String = MonitorV2.NO_ID, |
45 | | - override val version: Long = MonitorV2.NO_VERSION, |
| 45 | + override val id: String = NO_ID, |
| 46 | + override val version: Long = NO_VERSION, |
46 | 47 | override val name: String, |
47 | 48 | override val enabled: Boolean, |
48 | 49 | override val schedule: Schedule, |
@@ -122,7 +123,7 @@ data class PPLMonitor( |
122 | 123 | builder.nonOptionalTimeField(MonitorV2.LAST_UPDATE_TIME_FIELD, lastUpdateTime) |
123 | 124 | builder.optionalTimeField(MonitorV2.ENABLED_TIME_FIELD, enabledTime) |
124 | 125 | builder.field(MonitorV2.TRIGGERS_FIELD, triggers.toTypedArray()) |
125 | | - builder.field(Monitor.SCHEMA_VERSION_FIELD, schemaVersion) |
| 126 | + builder.field(SCHEMA_VERSION_FIELD, schemaVersion) |
126 | 127 | builder.field(QUERY_LANGUAGE_FIELD, queryLanguage.value) |
127 | 128 | builder.field(QUERY_FIELD, query) |
128 | 129 |
|
@@ -250,7 +251,7 @@ data class PPLMonitor( |
250 | 251 | triggers.add(PPLTrigger.parseInner(xcp)) |
251 | 252 | } |
252 | 253 | } |
253 | | - Monitor.SCHEMA_VERSION_FIELD -> schemaVersion = xcp.intValue() |
| 254 | + SCHEMA_VERSION_FIELD -> schemaVersion = xcp.intValue() |
254 | 255 | QUERY_LANGUAGE_FIELD -> { |
255 | 256 | val input = xcp.text() |
256 | 257 | val enumMatchResult = QueryLanguage.enumFromString(input) |
|
0 commit comments