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

Change to accomodate findingIds in security analytics #569

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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 @@ -9,6 +9,7 @@ import java.io.IOException

class GetAlertsRequest : ActionRequest {
val table: Table
val findingIds: List<String>?
val severityLevel: String
val alertState: String
val monitorId: String?
Expand All @@ -19,6 +20,7 @@ class GetAlertsRequest : ActionRequest {

constructor(
table: Table,
findingIds: List<String>?,
severityLevel: String,
alertState: String,
monitorId: String?,
Expand All @@ -28,6 +30,7 @@ class GetAlertsRequest : ActionRequest {
alertIds: List<String>? = null
) : super() {
this.table = table
this.findingIds = findingIds
this.severityLevel = severityLevel
this.alertState = alertState
this.monitorId = monitorId
Expand All @@ -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(),
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ internal class GetAlertsRequestTests {

val req = GetAlertsRequest(
table = table,
findingIds = listOf(),
severityLevel = "1",
alertState = "active",
monitorId = null,
Expand Down Expand Up @@ -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()
Expand All @@ -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())
}
Expand Down