Files
diun/internal/model/notif_slack.go
2021-06-25 23:24:02 +02:00

23 lines
765 B
Go

package model
// NotifSlackDefaultTemplateBody ...
const NotifSlackDefaultTemplateBody = "<!channel> Docker tag `{{ .Entry.Image }}` {{ if (eq .Entry.Status \"new\") }}newly added{{ else }}updated{{ end }}."
// NotifSlack holds slack notification configuration details
type NotifSlack struct {
WebhookURL string `yaml:"webhookURL,omitempty" json:"webhookURL,omitempty" validate:"required"`
TemplateBody string `yaml:"templateBody,omitempty" json:"templateBody,omitempty" validate:"required"`
}
// GetDefaults gets the default values
func (s *NotifSlack) GetDefaults() *NotifSlack {
n := &NotifSlack{}
n.SetDefaults()
return n
}
// SetDefaults sets the default values
func (s *NotifSlack) SetDefaults() {
s.TemplateBody = NotifSlackDefaultTemplateBody
}