-
Notifications
You must be signed in to change notification settings - Fork 96
/
sigs_clientset.go
44 lines (40 loc) · 1.45 KB
/
sigs_clientset.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
package client
import (
"context"
"k8s.io/apimachinery/pkg/runtime"
k8sclient "sigs.k8s.io/controller-runtime/pkg/client"
fakesigs "sigs.k8s.io/controller-runtime/pkg/client/fake"
)
//go:generate moq -out sigs_client_moq.go . SigsClientInterface
type SigsClientInterface interface {
k8sclient.Reader
k8sclient.Writer
k8sclient.StatusClient
GetSigsClient() k8sclient.Client
}
func NewSigsClientMoqWithScheme(clientScheme *runtime.Scheme, initObjs ...runtime.Object) *SigsClientInterfaceMock {
sigsClient := fakesigs.NewFakeClientWithScheme(clientScheme, initObjs...)
return &SigsClientInterfaceMock{
GetSigsClientFunc: func() k8sclient.Client {
return sigsClient
},
GetFunc: func(ctx context.Context, key k8sclient.ObjectKey, obj runtime.Object) error {
return sigsClient.Get(ctx, key, obj)
},
CreateFunc: func(ctx context.Context, obj runtime.Object, opts ...k8sclient.CreateOption) error {
return sigsClient.Create(ctx, obj)
},
UpdateFunc: func(ctx context.Context, obj runtime.Object, opts ...k8sclient.UpdateOption) error {
return sigsClient.Update(ctx, obj)
},
DeleteFunc: func(ctx context.Context, obj runtime.Object, opts ...k8sclient.DeleteOption) error {
return sigsClient.Delete(ctx, obj)
},
ListFunc: func(ctx context.Context, list runtime.Object, opts ...k8sclient.ListOption) error {
return sigsClient.List(ctx, list, opts...)
},
StatusFunc: func() k8sclient.StatusWriter {
return sigsClient.Status()
},
}
}