-
-
Notifications
You must be signed in to change notification settings - Fork 442
/
options.go
42 lines (34 loc) · 1.09 KB
/
options.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package opensearch
import "github.com/testcontainers/testcontainers-go"
// Options is a struct for specifying options for the OpenSearch container.
type Options struct {
Password string
Username string
}
func defaultOptions() *Options {
return &Options{
Username: defaultUsername,
Password: defaultPassword,
}
}
// Compiler check to ensure that Option implements the testcontainers.ContainerCustomizer interface.
var _ testcontainers.ContainerCustomizer = (*Option)(nil)
// Option is an option for the OpenSearch container.
type Option func(*Options)
// Customize is a NOOP. It's defined to satisfy the testcontainers.ContainerCustomizer interface.
func (o Option) Customize(*testcontainers.GenericContainerRequest) error {
// NOOP to satisfy interface.
return nil
}
// WithPassword sets the password for the OpenSearch container.
func WithPassword(password string) Option {
return func(o *Options) {
o.Password = password
}
}
// WithUsername sets the username for the OpenSearch container.
func WithUsername(username string) Option {
return func(o *Options) {
o.Username = username
}
}