alrm/alarm/alarm.go

21 lines
363 B
Go
Raw Normal View History

package alarm
import (
2021-01-24 13:32:39 -09:00
"alrm/alarm/email"
2021-01-24 13:59:53 -09:00
"fmt"
)
type Alarm interface {
Parse(string) (bool, error)
Alarm(string, string, string, error) error
}
func NewAlarm(name string, typename string) (Alarm, error) {
switch typename {
case "email":
2021-01-24 13:32:39 -09:00
return email.NewAlarmEmail(name), nil
default:
return nil, fmt.Errorf("unknown alarm name \"%s\"", name)
}
}