feat(alerting): adds endpoint for getting alert states log
This commit is contained in:
@@ -1,15 +1,16 @@
|
||||
package models
|
||||
|
||||
import "time"
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type AlertStateLog struct {
|
||||
Id int64 `json:"id"`
|
||||
OrgId int64 `json:"-"`
|
||||
AlertId int64 `json:"alertId"`
|
||||
State string `json:"type"`
|
||||
Created time.Time `json:"created"`
|
||||
Acknowledged time.Time `json:"acknowledged"`
|
||||
Deleted time.Time `json:"deleted"`
|
||||
Id int64 `json:"-"`
|
||||
OrgId int64 `json:"-"`
|
||||
AlertId int64 `json:"alertId"`
|
||||
NewState string `json:"newState"`
|
||||
Created time.Time `json:"created"`
|
||||
Info string `json:"info"`
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -23,6 +24,8 @@ func (this *UpdateAlertStateCommand) IsValidState() bool {
|
||||
return this.NewState == ALERT_STATE_OK || this.NewState == ALERT_STATE_WARN || this.NewState == ALERT_STATE_ALERT || this.NewState == ALERT_STATE_ACKNOWLEDGED
|
||||
}
|
||||
|
||||
// Commands
|
||||
|
||||
type UpdateAlertStateCommand struct {
|
||||
AlertId int64 `json:"alertId" binding:"Required"`
|
||||
NewState string `json:"newState" binding:"Required"`
|
||||
@@ -30,3 +33,12 @@ type UpdateAlertStateCommand struct {
|
||||
|
||||
Result *AlertRule
|
||||
}
|
||||
|
||||
// Queries
|
||||
|
||||
type GetAlertsStateLogCommand struct {
|
||||
OrgId int64 `json:"orgId" binding:"Required"`
|
||||
AlertId int64 `json:"alertId" binding:"Required"`
|
||||
|
||||
Result *[]AlertStateLog
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user