feat(alerting): adds endpoint for getting alert states log

This commit is contained in:
bergquist
2016-04-28 10:59:46 +02:00
parent 3ecc13506c
commit 0f0fa0c257
7 changed files with 85 additions and 12 deletions
+20 -8
View File
@@ -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
}