-
Notifications
You must be signed in to change notification settings - Fork 8
/
aiven_application_builder.go
45 lines (38 loc) · 1.09 KB
/
aiven_application_builder.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
package aiven_nais_io_v1
import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
type AivenApplicationBuilder struct {
application AivenApplication
}
func NewAivenApplicationBuilder(name, namespace string) AivenApplicationBuilder {
return AivenApplicationBuilder{
application: AivenApplication{
TypeMeta: metav1.TypeMeta{
Kind: "AivenApplication",
APIVersion: "aiven.nais.io/v1",
},
ObjectMeta: metav1.ObjectMeta{
Name: name,
Namespace: namespace,
},
Spec: AivenApplicationSpec{},
Status: AivenApplicationStatus{},
},
}
}
func (b AivenApplicationBuilder) WithSpec(spec AivenApplicationSpec) AivenApplicationBuilder {
b.application.Spec = spec
return b
}
func (b AivenApplicationBuilder) WithStatus(status AivenApplicationStatus) AivenApplicationBuilder {
b.application.Status = status
return b
}
func (b AivenApplicationBuilder) WithAnnotation(key, value string) AivenApplicationBuilder {
b.application.SetAnnotations(map[string]string{
key: value,
})
return b
}
func (b AivenApplicationBuilder) Build() AivenApplication {
return b.application
}