-
Notifications
You must be signed in to change notification settings - Fork 6
/
options.go
64 lines (53 loc) · 1.35 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// SPDX-FileCopyrightText: 2023 SAP SE or an SAP affiliate company and Gardener contributors
//
// SPDX-License-Identifier: Apache-2.0
package gardener
import (
"log/slog"
"k8s.io/client-go/rest"
)
// CreateOption is a function that acts on a Provider
// and is used to construct such objects.
type CreateOption func(*Provider)
// WithID sets the id of a Provider.
func WithID(id string) CreateOption {
return func(p *Provider) {
p.id = id
}
}
// WithName sets the name of a Provider.
func WithName(name string) CreateOption {
return func(p *Provider) {
p.name = name
}
}
// WithShootConfig sets the ShootConfig of a Provider.
func WithShootConfig(config *rest.Config) CreateOption {
return func(p *Provider) {
p.ShootConfig = config
}
}
// WithSeedConfig sets the SeedConfig of a Provider.
func WithSeedConfig(config *rest.Config) CreateOption {
return func(p *Provider) {
p.SeedConfig = config
}
}
// WithArgs sets the arguments of a Provider.
func WithArgs(args Args) CreateOption {
return func(p *Provider) {
p.Args = args
}
}
// WithMetadata sets the metadata of a Provider.
func WithMetadata(metadata map[string]string) CreateOption {
return func(p *Provider) {
p.metadata = metadata
}
}
// WithLogger sets the logger of a Provider.
func WithLogger(logger *slog.Logger) CreateOption {
return func(p *Provider) {
p.logger = logger
}
}