Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport 2.x] add list of alert ids in get alerts request #286

Merged
merged 1 commit into from
Oct 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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