-
Notifications
You must be signed in to change notification settings - Fork 22
/
ingress.go
91 lines (75 loc) · 3.11 KB
/
ingress.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
package mocks
import (
"context"
"fmt"
netv1 "k8s.io/api/networking/v1"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
networkingv1 "k8s.io/client-go/applyconfigurations/networking/v1"
v1 "k8s.io/client-go/kubernetes/typed/networking/v1"
)
// compile simulation whether ClientsetMock implements interface
var _ v1.IngressInterface = (*Ingress)(nil)
type Ingress struct{}
func NewIngress() *Ingress {
return &Ingress{}
}
// Apply implements v1.IngressInterface
func (*Ingress) Apply(ctx context.Context, ingress *networkingv1.IngressApplyConfiguration, opts metav1.ApplyOptions) (result *netv1.Ingress, err error) {
panic("unimplemented")
}
// ApplyStatus implements v1.IngressInterface
func (*Ingress) ApplyStatus(ctx context.Context, ingress *networkingv1.IngressApplyConfiguration, opts metav1.ApplyOptions) (result *netv1.Ingress, err error) {
panic("unimplemented")
}
// Create implements v1.IngressInterface
func (*Ingress) Create(ctx context.Context, ingress *netv1.Ingress, opts metav1.CreateOptions) (*netv1.Ingress, error) {
if ingress.ObjectMeta.Name == "create_bad" {
return nil, fmt.Errorf("mock error: cannot create ingress")
} else {
return nil, fmt.Errorf("mock error: unknown")
}
}
// Delete implements v1.IngressInterface
func (*Ingress) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
if name == "delete_bad" {
return fmt.Errorf("mock error: cannot delete ingress")
} else {
return errors.NewNotFound(schema.GroupResource{}, name)
}
}
// DeleteCollection implements v1.IngressInterface
func (*Ingress) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
panic("unimplemented")
}
// Get implements v1.IngressInterface
func (*Ingress) Get(ctx context.Context, name string, opts metav1.GetOptions) (*netv1.Ingress, error) {
panic("unimplemented")
}
// List implements v1.IngressInterface
func (*Ingress) List(ctx context.Context, opts metav1.ListOptions) (*netv1.IngressList, error) {
panic("unimplemented")
}
// Patch implements v1.IngressInterface
func (*Ingress) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *netv1.Ingress, err error) {
panic("unimplemented")
}
// Update implements v1.IngressInterface
func (*Ingress) Update(ctx context.Context, ingress *netv1.Ingress, opts metav1.UpdateOptions) (*netv1.Ingress, error) {
if ingress.ObjectMeta.Name == "update_bad" {
return nil, errors.NewBadRequest("mock error: cannot update ingress")
} else {
return nil, errors.NewNotFound(schema.GroupResource{}, ingress.ObjectMeta.Name)
}
}
// UpdateStatus implements v1.IngressInterface
func (*Ingress) UpdateStatus(ctx context.Context, ingress *netv1.Ingress, opts metav1.UpdateOptions) (*netv1.Ingress, error) {
panic("unimplemented")
}
// Watch implements v1.IngressInterface
func (*Ingress) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
panic("unimplemented")
}