2019-06-04 20:11:54 +00:00
|
|
|
package model
|
|
|
|
|
2020-06-07 19:58:49 +00:00
|
|
|
import (
|
|
|
|
"github.com/crazy-max/diun/v3/pkg/utl"
|
|
|
|
)
|
|
|
|
|
2019-06-04 20:11:54 +00:00
|
|
|
// Watch holds data necessary for watch configuration
|
|
|
|
type Watch struct {
|
2020-06-07 19:58:49 +00:00
|
|
|
Workers int `yaml:"workers,omitempty" json:"workers,omitempty" validate:"required,min=1"`
|
|
|
|
Schedule string `yaml:"schedule,omitempty" json:"schedule,omitempty" validate:"required"`
|
|
|
|
FirstCheckNotif *bool `yaml:"firstCheckNotif,omitempty" json:"firstCheckNotif,omitempty" validate:"required"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetDefaults gets the default values
|
|
|
|
func (s *Watch) GetDefaults() *Watch {
|
|
|
|
n := &Watch{}
|
|
|
|
n.SetDefaults()
|
|
|
|
return n
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetDefaults sets the default values
|
|
|
|
func (s *Watch) SetDefaults() {
|
|
|
|
s.Workers = 10
|
|
|
|
s.Schedule = "0 * * * *"
|
|
|
|
s.FirstCheckNotif = utl.NewFalse()
|
2019-06-04 20:11:54 +00:00
|
|
|
}
|