Skip to content

Commit

Permalink
add list of alert ids in get alerts request (#284) (#286)
Browse files Browse the repository at this point in the history
Signed-off-by: Surya Sashank Nistala <snistala@amazon.com>
(cherry picked from commit fdd7cbb)
  • Loading branch information
opensearch-trigger-bot[bot] authored Oct 17, 2022
1 parent 99006a8 commit 40404e2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,24 @@ class GetAlertsRequest : ActionRequest {
val monitorId: String?
val alertIndex: String?
val monitorIds: List<String>?
val alertIds: List<String>?

constructor(
table: Table,
severityLevel: String,
alertState: String,
monitorId: String?,
alertIndex: String?,
monitorIds: List<String>? = null
monitorIds: List<String>? = null,
alertIds: List<String>? = null
) : super() {
this.table = table
this.severityLevel = severityLevel
this.alertState = alertState
this.monitorId = monitorId
this.alertIndex = alertIndex
this.monitorIds = monitorIds
this.alertIds = alertIds
}

@Throws(IOException::class)
Expand All @@ -38,7 +41,8 @@ class GetAlertsRequest : ActionRequest {
alertState = sin.readString(),
monitorId = sin.readOptionalString(),
alertIndex = sin.readOptionalString(),
monitorIds = sin.readOptionalStringList()
monitorIds = sin.readOptionalStringList(),
alertIds = sin.readOptionalStringList()
)

override fun validate(): ActionRequestValidationException? {
Expand All @@ -53,5 +57,6 @@ class GetAlertsRequest : ActionRequest {
out.writeOptionalString(monitorId)
out.writeOptionalString(alertIndex)
out.writeOptionalStringCollection(monitorIds)
out.writeOptionalStringCollection(alertIds)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ internal class GetAlertsRequestTests {

val table = Table("asc", "sortString", null, 1, 0, "")

val req = GetAlertsRequest(table, "1", "active", null, null, listOf("1", "2"))
val req = GetAlertsRequest(table, "1", "active", null, null, listOf("1", "2"), listOf("alert1", "alert2"))
assertNotNull(req)

val out = BytesStreamOutput()
Expand All @@ -30,6 +30,8 @@ internal class GetAlertsRequestTests {
assertEquals(table, newReq.table)
assertTrue(newReq.monitorIds!!.contains("1"))
assertTrue(newReq.monitorIds!!.contains("2"))
assertTrue(newReq.alertIds!!.contains("alert1"))
assertTrue(newReq.alertIds!!.contains("alert2"))
}

@Test
Expand Down

0 comments on commit 40404e2

Please sign in to comment.