blob: 8e9ccd59de6e7e4e54d3f552aae003216a32780a [file] [log] [blame]
Matteo Scandoloa4285862020-12-01 18:10:10 -08001/*
2Copyright The Kubernetes Authors.
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16
17// Code generated by client-gen. DO NOT EDIT.
18
19package v1
20
21import (
22 "context"
23 "time"
24
25 autoscalingv1 "k8s.io/api/autoscaling/v1"
26 v1 "k8s.io/api/core/v1"
27 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
28 types "k8s.io/apimachinery/pkg/types"
29 watch "k8s.io/apimachinery/pkg/watch"
30 scheme "k8s.io/client-go/kubernetes/scheme"
31 rest "k8s.io/client-go/rest"
32)
33
34// ReplicationControllersGetter has a method to return a ReplicationControllerInterface.
35// A group's client should implement this interface.
36type ReplicationControllersGetter interface {
37 ReplicationControllers(namespace string) ReplicationControllerInterface
38}
39
40// ReplicationControllerInterface has methods to work with ReplicationController resources.
41type ReplicationControllerInterface interface {
42 Create(ctx context.Context, replicationController *v1.ReplicationController, opts metav1.CreateOptions) (*v1.ReplicationController, error)
43 Update(ctx context.Context, replicationController *v1.ReplicationController, opts metav1.UpdateOptions) (*v1.ReplicationController, error)
44 UpdateStatus(ctx context.Context, replicationController *v1.ReplicationController, opts metav1.UpdateOptions) (*v1.ReplicationController, error)
45 Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error
46 DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error
47 Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.ReplicationController, error)
48 List(ctx context.Context, opts metav1.ListOptions) (*v1.ReplicationControllerList, error)
49 Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error)
50 Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ReplicationController, err error)
51 GetScale(ctx context.Context, replicationControllerName string, options metav1.GetOptions) (*autoscalingv1.Scale, error)
52 UpdateScale(ctx context.Context, replicationControllerName string, scale *autoscalingv1.Scale, opts metav1.UpdateOptions) (*autoscalingv1.Scale, error)
53
54 ReplicationControllerExpansion
55}
56
57// replicationControllers implements ReplicationControllerInterface
58type replicationControllers struct {
59 client rest.Interface
60 ns string
61}
62
63// newReplicationControllers returns a ReplicationControllers
64func newReplicationControllers(c *CoreV1Client, namespace string) *replicationControllers {
65 return &replicationControllers{
66 client: c.RESTClient(),
67 ns: namespace,
68 }
69}
70
71// Get takes name of the replicationController, and returns the corresponding replicationController object, and an error if there is any.
72func (c *replicationControllers) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ReplicationController, err error) {
73 result = &v1.ReplicationController{}
74 err = c.client.Get().
75 Namespace(c.ns).
76 Resource("replicationcontrollers").
77 Name(name).
78 VersionedParams(&options, scheme.ParameterCodec).
79 Do(ctx).
80 Into(result)
81 return
82}
83
84// List takes label and field selectors, and returns the list of ReplicationControllers that match those selectors.
85func (c *replicationControllers) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ReplicationControllerList, err error) {
86 var timeout time.Duration
87 if opts.TimeoutSeconds != nil {
88 timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
89 }
90 result = &v1.ReplicationControllerList{}
91 err = c.client.Get().
92 Namespace(c.ns).
93 Resource("replicationcontrollers").
94 VersionedParams(&opts, scheme.ParameterCodec).
95 Timeout(timeout).
96 Do(ctx).
97 Into(result)
98 return
99}
100
101// Watch returns a watch.Interface that watches the requested replicationControllers.
102func (c *replicationControllers) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
103 var timeout time.Duration
104 if opts.TimeoutSeconds != nil {
105 timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
106 }
107 opts.Watch = true
108 return c.client.Get().
109 Namespace(c.ns).
110 Resource("replicationcontrollers").
111 VersionedParams(&opts, scheme.ParameterCodec).
112 Timeout(timeout).
113 Watch(ctx)
114}
115
116// Create takes the representation of a replicationController and creates it. Returns the server's representation of the replicationController, and an error, if there is any.
117func (c *replicationControllers) Create(ctx context.Context, replicationController *v1.ReplicationController, opts metav1.CreateOptions) (result *v1.ReplicationController, err error) {
118 result = &v1.ReplicationController{}
119 err = c.client.Post().
120 Namespace(c.ns).
121 Resource("replicationcontrollers").
122 VersionedParams(&opts, scheme.ParameterCodec).
123 Body(replicationController).
124 Do(ctx).
125 Into(result)
126 return
127}
128
129// Update takes the representation of a replicationController and updates it. Returns the server's representation of the replicationController, and an error, if there is any.
130func (c *replicationControllers) Update(ctx context.Context, replicationController *v1.ReplicationController, opts metav1.UpdateOptions) (result *v1.ReplicationController, err error) {
131 result = &v1.ReplicationController{}
132 err = c.client.Put().
133 Namespace(c.ns).
134 Resource("replicationcontrollers").
135 Name(replicationController.Name).
136 VersionedParams(&opts, scheme.ParameterCodec).
137 Body(replicationController).
138 Do(ctx).
139 Into(result)
140 return
141}
142
143// UpdateStatus was generated because the type contains a Status member.
144// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
145func (c *replicationControllers) UpdateStatus(ctx context.Context, replicationController *v1.ReplicationController, opts metav1.UpdateOptions) (result *v1.ReplicationController, err error) {
146 result = &v1.ReplicationController{}
147 err = c.client.Put().
148 Namespace(c.ns).
149 Resource("replicationcontrollers").
150 Name(replicationController.Name).
151 SubResource("status").
152 VersionedParams(&opts, scheme.ParameterCodec).
153 Body(replicationController).
154 Do(ctx).
155 Into(result)
156 return
157}
158
159// Delete takes name of the replicationController and deletes it. Returns an error if one occurs.
160func (c *replicationControllers) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
161 return c.client.Delete().
162 Namespace(c.ns).
163 Resource("replicationcontrollers").
164 Name(name).
165 Body(&opts).
166 Do(ctx).
167 Error()
168}
169
170// DeleteCollection deletes a collection of objects.
171func (c *replicationControllers) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
172 var timeout time.Duration
173 if listOpts.TimeoutSeconds != nil {
174 timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
175 }
176 return c.client.Delete().
177 Namespace(c.ns).
178 Resource("replicationcontrollers").
179 VersionedParams(&listOpts, scheme.ParameterCodec).
180 Timeout(timeout).
181 Body(&opts).
182 Do(ctx).
183 Error()
184}
185
186// Patch applies the patch and returns the patched replicationController.
187func (c *replicationControllers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ReplicationController, err error) {
188 result = &v1.ReplicationController{}
189 err = c.client.Patch(pt).
190 Namespace(c.ns).
191 Resource("replicationcontrollers").
192 Name(name).
193 SubResource(subresources...).
194 VersionedParams(&opts, scheme.ParameterCodec).
195 Body(data).
196 Do(ctx).
197 Into(result)
198 return
199}
200
201// GetScale takes name of the replicationController, and returns the corresponding autoscalingv1.Scale object, and an error if there is any.
202func (c *replicationControllers) GetScale(ctx context.Context, replicationControllerName string, options metav1.GetOptions) (result *autoscalingv1.Scale, err error) {
203 result = &autoscalingv1.Scale{}
204 err = c.client.Get().
205 Namespace(c.ns).
206 Resource("replicationcontrollers").
207 Name(replicationControllerName).
208 SubResource("scale").
209 VersionedParams(&options, scheme.ParameterCodec).
210 Do(ctx).
211 Into(result)
212 return
213}
214
215// UpdateScale takes the top resource name and the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any.
216func (c *replicationControllers) UpdateScale(ctx context.Context, replicationControllerName string, scale *autoscalingv1.Scale, opts metav1.UpdateOptions) (result *autoscalingv1.Scale, err error) {
217 result = &autoscalingv1.Scale{}
218 err = c.client.Put().
219 Namespace(c.ns).
220 Resource("replicationcontrollers").
221 Name(replicationControllerName).
222 SubResource("scale").
223 VersionedParams(&opts, scheme.ParameterCodec).
224 Body(scale).
225 Do(ctx).
226 Into(result)
227 return
228}