...
1
2 package fobject
3
4 import (
5 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
6 "k8s.io/apimachinery/pkg/runtime"
7 "k8s.io/apimachinery/pkg/runtime/schema"
8 apischeme "k8s.io/apimachinery/pkg/runtime/schema"
9 "sigs.k8s.io/controller-runtime/pkg/scheme"
10 )
11
12
13
14
15
16 const (
17 FakeGroupName = "fake.ncr.com"
18 FakeVersion = "v1"
19 )
20
21 var (
22
23 FakeGroupVersion = schema.GroupVersion{Group: FakeGroupName, Version: FakeVersion}
24
25
26 FakeSchemeBuilder = &scheme.Builder{GroupVersion: FakeGroupVersion}
27
28
29 AddFakeToScheme = FakeSchemeBuilder.AddToScheme
30
31 FakeGroupResource = apischeme.GroupResource{Group: FakeGroupName, Resource: "Fake"}
32 )
33
34 type FakeSpec struct {
35 Suspend bool `json:"suspend,omitempty"`
36 Value string `json:"value,omitempty"`
37 Interval metav1.Duration `json:"interval"`
38 }
39
40 type FakeStatus struct {
41 ObservedGeneration int64 `json:"observedGeneration,omitempty"`
42 Conditions []metav1.Condition `json:"conditions,omitempty"`
43 ObservedValue string `json:"observedValue,omitempty"`
44 }
45
46 func (f Fake) GetConditions() []metav1.Condition {
47 return f.Status.Conditions
48 }
49
50 func (f *Fake) SetConditions(conditions []metav1.Condition) {
51 f.Status.Conditions = conditions
52 }
53
54 func (f *Fake) DeepCopyInto(out *Fake) {
55 *out = *f
56 out.TypeMeta = f.TypeMeta
57 f.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
58 f.Status.DeepCopyInto(&out.Status)
59 }
60
61 func (f *Fake) DeepCopy() *Fake {
62 if f == nil {
63 return nil
64 }
65 out := new(Fake)
66 f.DeepCopyInto(out)
67 return out
68 }
69
70 func (f *Fake) DeepCopyObject() runtime.Object {
71 return f.DeepCopy()
72 }
73
74 func (in *FakeList) DeepCopyInto(out *FakeList) {
75 *out = *in
76 out.TypeMeta = in.TypeMeta
77 in.ListMeta.DeepCopyInto(&out.ListMeta)
78 if in.Items != nil {
79 in, out := &in.Items, &out.Items
80 *out = make([]Fake, len(*in))
81 for i := range *in {
82 (*in)[i].DeepCopyInto(&(*out)[i])
83 }
84 }
85 }
86
87 func (in *FakeList) DeepCopy() *FakeList {
88 if in == nil {
89 return nil
90 }
91 out := new(FakeList)
92 in.DeepCopyInto(out)
93 return out
94 }
95
96 func (in *FakeList) DeepCopyObject() runtime.Object {
97 return in.DeepCopy()
98 }
99
100 func (f *FakeSpec) DeepCopyInto(out *FakeSpec) {
101 *out = *f
102 }
103
104 func (f *FakeSpec) DeepCopy() *FakeSpec {
105 if f == nil {
106 return nil
107 }
108 out := new(FakeSpec)
109 f.DeepCopyInto(out)
110 return out
111 }
112
113 func (f *FakeStatus) DeepCopyInto(out *FakeStatus) {
114 *out = *f
115 if f.Conditions != nil {
116 in, out := &f.Conditions, &out.Conditions
117 *out = make([]metav1.Condition, len(*in))
118 for i := range *in {
119 (*in)[i].DeepCopyInto(&(*out)[i])
120 }
121 }
122 }
123
124 func (f *FakeStatus) DeepCopy() *FakeStatus {
125 if f == nil {
126 return nil
127 }
128 out := new(FakeStatus)
129 f.DeepCopyInto(out)
130 return out
131 }
132
133
134
135
136
137
138
139 type Fake struct {
140 metav1.TypeMeta `json:",inline"`
141 metav1.ObjectMeta `json:"metadata,omitempty"`
142
143 Spec FakeSpec `json:"spec,omitempty"`
144
145 Status FakeStatus `json:"status,omitempty"`
146 }
147
148
149
150 type FakeList struct {
151 metav1.TypeMeta `json:",inline"`
152 metav1.ListMeta `json:"metadata,omitempty"`
153 Items []Fake `json:"items"`
154 }
155
156 func init() {
157 FakeSchemeBuilder.Register(&Fake{}, &FakeList{})
158 }
159
View as plain text