From f003869aca5cec1440bc42b77295a3813210c9cb Mon Sep 17 00:00:00 2001 From: Stevan Buzejic Date: Mon, 15 May 2023 18:42:21 +0200 Subject: [PATCH] Extended deleted workflow response with list of monitor ids failed to delete (#416) Signed-off-by: Stevan Buzejic --- .../alerting/action/DeleteWorkflowResponse.kt | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/org/opensearch/commons/alerting/action/DeleteWorkflowResponse.kt b/src/main/kotlin/org/opensearch/commons/alerting/action/DeleteWorkflowResponse.kt index 7a4a2084..8da62c5e 100644 --- a/src/main/kotlin/org/opensearch/commons/alerting/action/DeleteWorkflowResponse.kt +++ b/src/main/kotlin/org/opensearch/commons/alerting/action/DeleteWorkflowResponse.kt @@ -10,29 +10,39 @@ import org.opensearch.core.xcontent.XContentBuilder class DeleteWorkflowResponse : BaseResponse { var id: String var version: Long + var nonDeletedMonitors: List? = null constructor( id: String, - version: Long + version: Long, + nonDeletedMonitors: List? = 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" + } }