alrm/alarm/alarm.go

21 lines
363 B
Go
Raw Normal View History

package alarm
import (
"fmt"
2021-01-24 13:32:39 -09:00
"alrm/alarm/email"
)
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)
}
}