diff --git a/src/main/kotlin/org/opensearch/commons/alerting/action/GetAlertsRequest.kt b/src/main/kotlin/org/opensearch/commons/alerting/action/GetAlertsRequest.kt index 8b8a5a1f..6dafb76d 100644 --- a/src/main/kotlin/org/opensearch/commons/alerting/action/GetAlertsRequest.kt +++ b/src/main/kotlin/org/opensearch/commons/alerting/action/GetAlertsRequest.kt @@ -9,6 +9,7 @@ import java.io.IOException class GetAlertsRequest : ActionRequest { val table: Table + val findingIds: List? val severityLevel: String val alertState: String val monitorId: String? @@ -19,6 +20,7 @@ class GetAlertsRequest : ActionRequest { constructor( table: Table, + findingIds: List?, severityLevel: String, alertState: String, monitorId: String?, @@ -28,6 +30,7 @@ class GetAlertsRequest : ActionRequest { alertIds: List? = null ) : super() { this.table = table + this.findingIds = findingIds this.severityLevel = severityLevel this.alertState = alertState this.monitorId = monitorId @@ -40,6 +43,7 @@ class GetAlertsRequest : ActionRequest { @Throws(IOException::class) constructor(sin: StreamInput) : this( table = Table.readFrom(sin), + findingIds = sin.readOptionalStringList(), severityLevel = sin.readString(), alertState = sin.readString(), monitorId = sin.readOptionalString(), @@ -56,6 +60,7 @@ class GetAlertsRequest : ActionRequest { @Throws(IOException::class) override fun writeTo(out: StreamOutput) { table.writeTo(out) + out.writeOptionalStringCollection(findingIds) out.writeString(severityLevel) out.writeString(alertState) out.writeOptionalString(monitorId) diff --git a/src/test/kotlin/org/opensearch/commons/alerting/action/GetAlertsRequestTests.kt b/src/test/kotlin/org/opensearch/commons/alerting/action/GetAlertsRequestTests.kt index bf301f74..18d4f690 100644 --- a/src/test/kotlin/org/opensearch/commons/alerting/action/GetAlertsRequestTests.kt +++ b/src/test/kotlin/org/opensearch/commons/alerting/action/GetAlertsRequestTests.kt @@ -18,6 +18,7 @@ internal class GetAlertsRequestTests { val req = GetAlertsRequest( table = table, + findingIds = listOf(), severityLevel = "1", alertState = "active", monitorId = null, @@ -49,7 +50,7 @@ internal class GetAlertsRequestTests { fun `test get alerts request with filter`() { val table = Table("asc", "sortString", null, 1, 0, "") - val req = GetAlertsRequest(table, "1", "active", null, null) + val req = GetAlertsRequest(table, null, "1", "active", null, null) assertNotNull(req) val out = BytesStreamOutput() @@ -67,7 +68,7 @@ internal class GetAlertsRequestTests { fun `test validate returns null`() { val table = Table("asc", "sortString", null, 1, 0, "") - val req = GetAlertsRequest(table, "1", "active", null, null) + val req = GetAlertsRequest(table, null, "1", "active", null, null) assertNotNull(req) assertNull(req.validate()) }