Skip to content

Commit

Permalink
Merge branch '2.14' into create-pull-request/patch
Browse files Browse the repository at this point in the history
  • Loading branch information
bowenlan-amzn authored Jun 4, 2024
2 parents 3e581b3 + fd12671 commit 611576e
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import org.opensearch.action.ActionRequestValidationException
import org.opensearch.commons.alerting.model.Table
import org.opensearch.core.common.io.stream.StreamInput
import org.opensearch.core.common.io.stream.StreamOutput
import org.opensearch.index.query.BoolQueryBuilder
import java.io.IOException

class GetAlertsRequest : ActionRequest {
Expand All @@ -16,6 +17,7 @@ class GetAlertsRequest : ActionRequest {
val monitorIds: List<String>?
val workflowIds: List<String>?
val alertIds: List<String>?
val boolQueryBuilder: BoolQueryBuilder?

constructor(
table: Table,
Expand All @@ -25,7 +27,8 @@ class GetAlertsRequest : ActionRequest {
alertIndex: String?,
monitorIds: List<String>? = null,
workflowIds: List<String>? = null,
alertIds: List<String>? = null
alertIds: List<String>? = null,
boolQueryBuilder: BoolQueryBuilder? = null
) : super() {
this.table = table
this.severityLevel = severityLevel
Expand All @@ -35,6 +38,7 @@ class GetAlertsRequest : ActionRequest {
this.monitorIds = monitorIds
this.workflowIds = workflowIds
this.alertIds = alertIds
this.boolQueryBuilder = boolQueryBuilder
}

@Throws(IOException::class)
Expand All @@ -46,7 +50,8 @@ class GetAlertsRequest : ActionRequest {
alertIndex = sin.readOptionalString(),
monitorIds = sin.readOptionalStringList(),
workflowIds = sin.readOptionalStringList(),
alertIds = sin.readOptionalStringList()
alertIds = sin.readOptionalStringList(),
boolQueryBuilder = if (sin.readOptionalBoolean() == true) BoolQueryBuilder(sin) else null
)

override fun validate(): ActionRequestValidationException? {
Expand All @@ -63,5 +68,11 @@ class GetAlertsRequest : ActionRequest {
out.writeOptionalStringCollection(monitorIds)
out.writeOptionalStringCollection(workflowIds)
out.writeOptionalStringCollection(alertIds)
if (boolQueryBuilder != null) {
out.writeOptionalBoolean(true)
boolQueryBuilder.writeTo(out)
} else {
out.writeOptionalBoolean(false)
}
}
}

0 comments on commit 611576e

Please sign in to comment.