Skip to content

Commit

Permalink
Extended deleted workflow response with list of monitor ids failed to…
Browse files Browse the repository at this point in the history
… delete (#416)

Signed-off-by: Stevan Buzejic <[email protected]>
  • Loading branch information
stevanbz authored and eirsep committed May 24, 2023
1 parent bb3f846 commit 27e4300
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ import org.opensearch.commons.alerting.action.GetWorkflowRequest
import org.opensearch.commons.alerting.action.GetWorkflowResponse
import org.opensearch.commons.alerting.action.IndexMonitorRequest
import org.opensearch.commons.alerting.action.IndexMonitorResponse
import org.opensearch.commons.alerting.action.PublishFindingsRequest
import org.opensearch.commons.alerting.action.SubscribeFindingsResponse
import org.opensearch.commons.alerting.action.IndexWorkflowRequest
import org.opensearch.commons.alerting.action.IndexWorkflowResponse
import org.opensearch.commons.alerting.action.PublishFindingsRequest
import org.opensearch.commons.alerting.action.SubscribeFindingsResponse
import org.opensearch.commons.notifications.action.BaseResponse
import org.opensearch.commons.utils.recreateObject

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,39 @@ import org.opensearch.core.xcontent.XContentBuilder
class DeleteWorkflowResponse : BaseResponse {
var id: String
var version: Long
var nonDeletedMonitors: List<String>? = null

constructor(
id: String,
version: Long
version: Long,
nonDeletedMonitors: List<String>? = null
) : super() {
this.id = id
this.version = version
this.nonDeletedMonitors = nonDeletedMonitors
}

constructor(sin: StreamInput) : this(
sin.readString(), // id
sin.readLong() // version
sin.readLong(), // version
sin.readOptionalStringList()
)

override fun writeTo(out: StreamOutput) {
out.writeString(id)
out.writeLong(version)
out.writeOptionalStringCollection(nonDeletedMonitors)
}

override fun toXContent(builder: XContentBuilder, params: ToXContent.Params): XContentBuilder {
return builder.startObject()
.field(IndexUtils._ID, id)
.field(IndexUtils._VERSION, version)
.field(NON_DELETED_MONITORS, nonDeletedMonitors)
.endObject()
}

companion object {
const val NON_DELETED_MONITORS = "NON_DELETED_MONITORS"
}
}

0 comments on commit 27e4300

Please sign in to comment.