You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
boundary/internal/daemon/worker/proxy/options.go

37 lines
883 B

package proxy
import (
serverpb "github.com/hashicorp/boundary/internal/gen/controller/servers/services"
)
// Option - how Options are passed as arguments.
type Option func(*Options)
// GetOpts - iterate the inbound Options and return a struct.
func GetOpts(opt ...Option) Options {
opts := getDefaultOptions()
for _, o := range opt {
o(&opts)
}
return opts
}
// Options = how options are represented
type Options struct {
WithInjectedApplicationCredentials []*serverpb.Credential
}
func getDefaultOptions() Options {
return Options{
WithInjectedApplicationCredentials: nil,
}
}
// WithInjectedApplicationCredentials provides an optional injected application
// credentials to use when establishing a proxy
func WithInjectedApplicationCredentials(creds []*serverpb.Credential) Option {
return func(o *Options) {
o.WithInjectedApplicationCredentials = creds
}
}