0
0
Fork 0
mirror of https://github.com/crazy-max/diun.git synced 2025-03-18 05:02:53 +00:00
crazy-max_diun/internal/model/watch.go

29 lines
946 B
Go
Raw Normal View History

2019-06-04 20:11:54 +00:00
package model
import (
2020-06-07 20:04:31 +00:00
"github.com/crazy-max/diun/v4/pkg/utl"
)
2019-06-04 20:11:54 +00:00
// Watch holds data necessary for watch configuration
type Watch struct {
Workers int `yaml:"workers,omitempty" json:"workers,omitempty" validate:"required,min=1"`
Schedule string `yaml:"schedule,omitempty" json:"schedule,omitempty"`
FirstCheckNotif *bool `yaml:"firstCheckNotif,omitempty" json:"firstCheckNotif,omitempty" validate:"required"`
CompareDigest *bool `yaml:"compareDigest,omitempty" json:"compareDigest,omitempty" validate:"required"`
Healthchecks *Healthchecks `yaml:"healthchecks,omitempty" json:"healthchecks,omitempty"`
}
// 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.FirstCheckNotif = utl.NewFalse()
s.CompareDigest = utl.NewTrue()
2019-06-04 20:11:54 +00:00
}