emissary/internal/agent/options.go
William Petit 42d49eb090
All checks were successful
arcad/emissary/pipeline/head This commit looks good
feat: move client to public package
2023-06-25 11:46:33 -06:00

44 lines
869 B
Go

package agent
import (
"time"
"forge.cadoles.com/Cadoles/emissary/internal/agent/metadata"
"forge.cadoles.com/Cadoles/emissary/pkg/client"
)
type Options struct {
Client *client.Client
Interval time.Duration
Controllers []Controller
Collectors []metadata.Collector
}
type OptionFunc func(*Options)
func defaultOption() *Options {
return &Options{
Controllers: make([]Controller, 0),
Interval: 10 * time.Second,
Collectors: make([]metadata.Collector, 0),
}
}
func WithControllers(controllers ...Controller) OptionFunc {
return func(opt *Options) {
opt.Controllers = controllers
}
}
func WithInterval(interval time.Duration) OptionFunc {
return func(opt *Options) {
opt.Interval = interval
}
}
func WithCollectors(collectors ...metadata.Collector) OptionFunc {
return func(opts *Options) {
opts.Collectors = collectors
}
}