1
16
17
18
19 package v1alpha2
20
21 import (
22 "context"
23 json "encoding/json"
24 "fmt"
25 "time"
26
27 v1alpha2 "k8s.io/api/resource/v1alpha2"
28 v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
29 types "k8s.io/apimachinery/pkg/types"
30 watch "k8s.io/apimachinery/pkg/watch"
31 resourcev1alpha2 "k8s.io/client-go/applyconfigurations/resource/v1alpha2"
32 scheme "k8s.io/client-go/kubernetes/scheme"
33 rest "k8s.io/client-go/rest"
34 )
35
36
37
38 type PodSchedulingContextsGetter interface {
39 PodSchedulingContexts(namespace string) PodSchedulingContextInterface
40 }
41
42
43 type PodSchedulingContextInterface interface {
44 Create(ctx context.Context, podSchedulingContext *v1alpha2.PodSchedulingContext, opts v1.CreateOptions) (*v1alpha2.PodSchedulingContext, error)
45 Update(ctx context.Context, podSchedulingContext *v1alpha2.PodSchedulingContext, opts v1.UpdateOptions) (*v1alpha2.PodSchedulingContext, error)
46 UpdateStatus(ctx context.Context, podSchedulingContext *v1alpha2.PodSchedulingContext, opts v1.UpdateOptions) (*v1alpha2.PodSchedulingContext, error)
47 Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
48 DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
49 Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha2.PodSchedulingContext, error)
50 List(ctx context.Context, opts v1.ListOptions) (*v1alpha2.PodSchedulingContextList, error)
51 Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
52 Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.PodSchedulingContext, err error)
53 Apply(ctx context.Context, podSchedulingContext *resourcev1alpha2.PodSchedulingContextApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.PodSchedulingContext, err error)
54 ApplyStatus(ctx context.Context, podSchedulingContext *resourcev1alpha2.PodSchedulingContextApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.PodSchedulingContext, err error)
55 PodSchedulingContextExpansion
56 }
57
58
59 type podSchedulingContexts struct {
60 client rest.Interface
61 ns string
62 }
63
64
65 func newPodSchedulingContexts(c *ResourceV1alpha2Client, namespace string) *podSchedulingContexts {
66 return &podSchedulingContexts{
67 client: c.RESTClient(),
68 ns: namespace,
69 }
70 }
71
72
73 func (c *podSchedulingContexts) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.PodSchedulingContext, err error) {
74 result = &v1alpha2.PodSchedulingContext{}
75 err = c.client.Get().
76 Namespace(c.ns).
77 Resource("podschedulingcontexts").
78 Name(name).
79 VersionedParams(&options, scheme.ParameterCodec).
80 Do(ctx).
81 Into(result)
82 return
83 }
84
85
86 func (c *podSchedulingContexts) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.PodSchedulingContextList, err error) {
87 var timeout time.Duration
88 if opts.TimeoutSeconds != nil {
89 timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
90 }
91 result = &v1alpha2.PodSchedulingContextList{}
92 err = c.client.Get().
93 Namespace(c.ns).
94 Resource("podschedulingcontexts").
95 VersionedParams(&opts, scheme.ParameterCodec).
96 Timeout(timeout).
97 Do(ctx).
98 Into(result)
99 return
100 }
101
102
103 func (c *podSchedulingContexts) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
104 var timeout time.Duration
105 if opts.TimeoutSeconds != nil {
106 timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
107 }
108 opts.Watch = true
109 return c.client.Get().
110 Namespace(c.ns).
111 Resource("podschedulingcontexts").
112 VersionedParams(&opts, scheme.ParameterCodec).
113 Timeout(timeout).
114 Watch(ctx)
115 }
116
117
118 func (c *podSchedulingContexts) Create(ctx context.Context, podSchedulingContext *v1alpha2.PodSchedulingContext, opts v1.CreateOptions) (result *v1alpha2.PodSchedulingContext, err error) {
119 result = &v1alpha2.PodSchedulingContext{}
120 err = c.client.Post().
121 Namespace(c.ns).
122 Resource("podschedulingcontexts").
123 VersionedParams(&opts, scheme.ParameterCodec).
124 Body(podSchedulingContext).
125 Do(ctx).
126 Into(result)
127 return
128 }
129
130
131 func (c *podSchedulingContexts) Update(ctx context.Context, podSchedulingContext *v1alpha2.PodSchedulingContext, opts v1.UpdateOptions) (result *v1alpha2.PodSchedulingContext, err error) {
132 result = &v1alpha2.PodSchedulingContext{}
133 err = c.client.Put().
134 Namespace(c.ns).
135 Resource("podschedulingcontexts").
136 Name(podSchedulingContext.Name).
137 VersionedParams(&opts, scheme.ParameterCodec).
138 Body(podSchedulingContext).
139 Do(ctx).
140 Into(result)
141 return
142 }
143
144
145
146 func (c *podSchedulingContexts) UpdateStatus(ctx context.Context, podSchedulingContext *v1alpha2.PodSchedulingContext, opts v1.UpdateOptions) (result *v1alpha2.PodSchedulingContext, err error) {
147 result = &v1alpha2.PodSchedulingContext{}
148 err = c.client.Put().
149 Namespace(c.ns).
150 Resource("podschedulingcontexts").
151 Name(podSchedulingContext.Name).
152 SubResource("status").
153 VersionedParams(&opts, scheme.ParameterCodec).
154 Body(podSchedulingContext).
155 Do(ctx).
156 Into(result)
157 return
158 }
159
160
161 func (c *podSchedulingContexts) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
162 return c.client.Delete().
163 Namespace(c.ns).
164 Resource("podschedulingcontexts").
165 Name(name).
166 Body(&opts).
167 Do(ctx).
168 Error()
169 }
170
171
172 func (c *podSchedulingContexts) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
173 var timeout time.Duration
174 if listOpts.TimeoutSeconds != nil {
175 timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
176 }
177 return c.client.Delete().
178 Namespace(c.ns).
179 Resource("podschedulingcontexts").
180 VersionedParams(&listOpts, scheme.ParameterCodec).
181 Timeout(timeout).
182 Body(&opts).
183 Do(ctx).
184 Error()
185 }
186
187
188 func (c *podSchedulingContexts) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.PodSchedulingContext, err error) {
189 result = &v1alpha2.PodSchedulingContext{}
190 err = c.client.Patch(pt).
191 Namespace(c.ns).
192 Resource("podschedulingcontexts").
193 Name(name).
194 SubResource(subresources...).
195 VersionedParams(&opts, scheme.ParameterCodec).
196 Body(data).
197 Do(ctx).
198 Into(result)
199 return
200 }
201
202
203 func (c *podSchedulingContexts) Apply(ctx context.Context, podSchedulingContext *resourcev1alpha2.PodSchedulingContextApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.PodSchedulingContext, err error) {
204 if podSchedulingContext == nil {
205 return nil, fmt.Errorf("podSchedulingContext provided to Apply must not be nil")
206 }
207 patchOpts := opts.ToPatchOptions()
208 data, err := json.Marshal(podSchedulingContext)
209 if err != nil {
210 return nil, err
211 }
212 name := podSchedulingContext.Name
213 if name == nil {
214 return nil, fmt.Errorf("podSchedulingContext.Name must be provided to Apply")
215 }
216 result = &v1alpha2.PodSchedulingContext{}
217 err = c.client.Patch(types.ApplyPatchType).
218 Namespace(c.ns).
219 Resource("podschedulingcontexts").
220 Name(*name).
221 VersionedParams(&patchOpts, scheme.ParameterCodec).
222 Body(data).
223 Do(ctx).
224 Into(result)
225 return
226 }
227
228
229
230 func (c *podSchedulingContexts) ApplyStatus(ctx context.Context, podSchedulingContext *resourcev1alpha2.PodSchedulingContextApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.PodSchedulingContext, err error) {
231 if podSchedulingContext == nil {
232 return nil, fmt.Errorf("podSchedulingContext provided to Apply must not be nil")
233 }
234 patchOpts := opts.ToPatchOptions()
235 data, err := json.Marshal(podSchedulingContext)
236 if err != nil {
237 return nil, err
238 }
239
240 name := podSchedulingContext.Name
241 if name == nil {
242 return nil, fmt.Errorf("podSchedulingContext.Name must be provided to Apply")
243 }
244
245 result = &v1alpha2.PodSchedulingContext{}
246 err = c.client.Patch(types.ApplyPatchType).
247 Namespace(c.ns).
248 Resource("podschedulingcontexts").
249 Name(*name).
250 SubResource("status").
251 VersionedParams(&patchOpts, scheme.ParameterCodec).
252 Body(data).
253 Do(ctx).
254 Into(result)
255 return
256 }
257
View as plain text