Skip to content

Commit

Permalink
Support backend roles in indexMonitorRequest (opensearch-project#308)
Browse files Browse the repository at this point in the history
Signed-off-by: Ashish Agrawal <ashisagr@amazon.com>

Signed-off-by: Ashish Agrawal <ashisagr@amazon.com>
  • Loading branch information
lezzago authored Nov 2, 2022
1 parent 67fda10 commit b7ceeec
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,24 @@ class IndexMonitorRequest : ActionRequest {
val refreshPolicy: WriteRequest.RefreshPolicy
val method: RestRequest.Method
var monitor: Monitor
val rbacRoles: List<String>?

constructor(
monitorId: String,
seqNo: Long,
primaryTerm: Long,
refreshPolicy: WriteRequest.RefreshPolicy,
method: RestRequest.Method,
monitor: Monitor
monitor: Monitor,
rbacRoles: List<String>? = null
) : super() {
this.monitorId = monitorId
this.seqNo = seqNo
this.primaryTerm = primaryTerm
this.refreshPolicy = refreshPolicy
this.method = method
this.monitor = monitor
this.rbacRoles = rbacRoles
}

@Throws(IOException::class)
Expand All @@ -40,7 +43,8 @@ class IndexMonitorRequest : ActionRequest {
primaryTerm = sin.readLong(),
refreshPolicy = WriteRequest.RefreshPolicy.readFrom(sin),
method = sin.readEnum(RestRequest.Method::class.java),
monitor = Monitor.readFrom(sin) as Monitor
monitor = Monitor.readFrom(sin) as Monitor,
rbacRoles = sin.readOptionalStringList()
)

override fun validate(): ActionRequestValidationException? {
Expand All @@ -55,5 +59,6 @@ class IndexMonitorRequest : ActionRequest {
refreshPolicy.writeTo(out)
out.writeEnum(method)
monitor.writeTo(out)
out.writeOptionalStringCollection(rbacRoles)
}
}

0 comments on commit b7ceeec

Please sign in to comment.