chore(alerting): style refactoring

This commit is contained in:
bergquist
2016-05-09 12:10:53 +02:00
parent 35c73902da
commit 3e462f2914
2 changed files with 11 additions and 11 deletions
+7 -5
View File
@@ -14,14 +14,16 @@ type AlertState struct {
}
var (
ALERT_STATE_OK = "OK"
ALERT_STATE_CRITICAL = "CRITICAL"
ALERT_STATE_WARN = "WARN"
ALERT_STATE_ACKNOWLEDGED = "ACKNOWLEDGED"
VALID_STATES = []string{"OK", "WARN", "CRITICAL", "ACKNOWLEDGED"}
)
func (this *UpdateAlertStateCommand) IsValidState() bool {
return this.NewState == ALERT_STATE_OK || this.NewState == ALERT_STATE_WARN || this.NewState == ALERT_STATE_CRITICAL || this.NewState == ALERT_STATE_ACKNOWLEDGED
for _, v := range VALID_STATES {
if this.NewState == v {
return true
}
}
return false
}
// Commands