mirror of
https://github.com/fluxcd/flagger.git
synced 2026-04-15 06:57:34 +00:00
31 lines
519 B
Go
31 lines
519 B
Go
package notifier
|
|
|
|
import (
|
|
"strings"
|
|
)
|
|
|
|
type Factory struct {
|
|
URL string
|
|
Username string
|
|
Channel string
|
|
}
|
|
|
|
func NewFactory(URL string, username string, channel string) *Factory {
|
|
return &Factory{
|
|
URL: URL,
|
|
Channel: channel,
|
|
Username: username,
|
|
}
|
|
}
|
|
|
|
func (f Factory) Notifier() (Interface, error) {
|
|
switch {
|
|
case strings.Contains(f.URL, "slack.com"):
|
|
return NewSlack(f.URL, f.Username, f.Channel)
|
|
case strings.Contains(f.URL, "office.com"):
|
|
return NewMSTeams(f.URL)
|
|
}
|
|
|
|
return nil, nil
|
|
}
|