Files
threshold-plugin-aws/plugin/option.go
T

36 lines
673 B
Go

package plugin
// getOpts iterates the inbound Options and returns a struct
func getOpts(opt ...Option) (options, error) {
opts := getDefaultOptions()
for _, o := range opt {
if o == nil {
continue
}
if err := o(&opts); err != nil {
return options{}, err
}
}
return opts, nil
}
// Option - how Options are passed as arguments
type Option func(*options) error
// options = how options are represented
type options struct {
withRegion string
}
func getDefaultOptions() options {
return options{}
}
// WithRegion contains the region to use
func WithRegion(with string) Option {
return func(o *options) error {
o.withRegion = with
return nil
}
}