Skip to content

Commit

Permalink
pass workflow id in alert constructors (#465) (#466)
Browse files Browse the repository at this point in the history
Signed-off-by: Surya Sashank Nistala <[email protected]>
(cherry picked from commit 37e36b7)

Co-authored-by: Surya Sashank Nistala <[email protected]>
  • Loading branch information
opensearch-trigger-bot[bot] and eirsep authored Jun 22, 2023
1 parent 55a4dd5 commit fca6d8e
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/main/kotlin/org/opensearch/commons/alerting/model/Alert.kt
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@ data class Alert(
actionExecutionResults: List<ActionExecutionResult> = mutableListOf(),
schemaVersion: Int = NO_SCHEMA_VERSION,
executionId: String? = null,
workflow: Workflow? = null,
workflowId: String? = null,
) : this(
monitorId = monitor.id, monitorName = monitor.name, monitorVersion = monitor.version, monitorUser = monitor.user,
triggerId = trigger.id, triggerName = trigger.name, state = state, startTime = startTime,
lastNotificationTime = lastNotificationTime, errorMessage = errorMessage, errorHistory = errorHistory,
severity = trigger.severity, actionExecutionResults = actionExecutionResults, schemaVersion = schemaVersion,
aggregationResultBucket = null, findingIds = emptyList(), relatedDocIds = emptyList(),
executionId = executionId, workflowId = workflow?.id ?: ""
executionId = executionId, workflowId = workflowId ?: ""
)

constructor(
Expand All @@ -101,14 +101,14 @@ data class Alert(
schemaVersion: Int = NO_SCHEMA_VERSION,
findingIds: List<String> = emptyList(),
executionId: String? = null,
workflow: Workflow? = null,
workflowId: String? = null,
) : this(
monitorId = monitor.id, monitorName = monitor.name, monitorVersion = monitor.version, monitorUser = monitor.user,
triggerId = trigger.id, triggerName = trigger.name, state = state, startTime = startTime,
lastNotificationTime = lastNotificationTime, errorMessage = errorMessage, errorHistory = errorHistory,
severity = trigger.severity, actionExecutionResults = actionExecutionResults, schemaVersion = schemaVersion,
aggregationResultBucket = null, findingIds = findingIds, relatedDocIds = emptyList(),
executionId = executionId, workflowId = workflow?.id ?: ""
executionId = executionId, workflowId = workflowId ?: ""
)

constructor(
Expand All @@ -124,14 +124,14 @@ data class Alert(
aggregationResultBucket: AggregationResultBucket,
findingIds: List<String> = emptyList(),
executionId: String? = null,
workflow: Workflow? = null,
workflowId: String? = null,
) : this(
monitorId = monitor.id, monitorName = monitor.name, monitorVersion = monitor.version, monitorUser = monitor.user,
triggerId = trigger.id, triggerName = trigger.name, state = state, startTime = startTime,
lastNotificationTime = lastNotificationTime, errorMessage = errorMessage, errorHistory = errorHistory,
severity = trigger.severity, actionExecutionResults = actionExecutionResults, schemaVersion = schemaVersion,
aggregationResultBucket = aggregationResultBucket, findingIds = findingIds, relatedDocIds = emptyList(),
executionId = executionId, workflowId = workflow?.id ?: ""
executionId = executionId, workflowId = workflowId ?: ""
)

constructor(
Expand All @@ -148,14 +148,14 @@ data class Alert(
actionExecutionResults: List<ActionExecutionResult> = mutableListOf(),
schemaVersion: Int = NO_SCHEMA_VERSION,
executionId: String? = null,
workflow: Workflow? = null,
workflowId: String? = null,
) : this(
id = id, monitorId = monitor.id, monitorName = monitor.name, monitorVersion = monitor.version, monitorUser = monitor.user,
triggerId = trigger.id, triggerName = trigger.name, state = state, startTime = startTime,
lastNotificationTime = lastNotificationTime, errorMessage = errorMessage, errorHistory = errorHistory,
severity = trigger.severity, actionExecutionResults = actionExecutionResults, schemaVersion = schemaVersion,
aggregationResultBucket = null, findingIds = findingIds, relatedDocIds = relatedDocIds,
executionId = executionId, workflowId = workflow?.id ?: ""
executionId = executionId, workflowId = workflowId ?: ""
)

constructor(
Expand All @@ -168,14 +168,14 @@ data class Alert(
errorMessage: String,
errorHistory: List<AlertError> = mutableListOf(),
schemaVersion: Int = NO_SCHEMA_VERSION,
workflow: Workflow? = null,
workflowId: String? = null,
) : this(
id = id, monitorId = monitor.id, monitorName = monitor.name, monitorVersion = monitor.version, monitorUser = monitor.user,
triggerId = trigger.id, triggerName = trigger.name, state = state, startTime = startTime,
lastNotificationTime = lastNotificationTime, errorMessage = errorMessage, errorHistory = errorHistory,
severity = trigger.severity, actionExecutionResults = listOf(), schemaVersion = schemaVersion,
aggregationResultBucket = null, findingIds = listOf(), relatedDocIds = listOf(),
workflowId = workflow?.id ?: ""
workflowId = workflowId ?: ""
)

enum class State {
Expand Down

0 comments on commit fca6d8e

Please sign in to comment.