blob: 64e3c18617446389d1c21905f09e1ae0af4bd4a6 [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 v1beta1
20
21import (
22 "context"
23 "time"
24
25 v1beta1 "k8s.io/api/extensions/v1beta1"
26 v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
27 types "k8s.io/apimachinery/pkg/types"
28 watch "k8s.io/apimachinery/pkg/watch"
29 scheme "k8s.io/client-go/kubernetes/scheme"
30 rest "k8s.io/client-go/rest"
31)
32
33// ReplicaSetsGetter has a method to return a ReplicaSetInterface.
34// A group's client should implement this interface.
35type ReplicaSetsGetter interface {
36 ReplicaSets(namespace string) ReplicaSetInterface
37}
38
39// ReplicaSetInterface has methods to work with ReplicaSet resources.
40type ReplicaSetInterface interface {
41 Create(ctx context.Context, replicaSet *v1beta1.ReplicaSet, opts v1.CreateOptions) (*v1beta1.ReplicaSet, error)
42 Update(ctx context.Context, replicaSet *v1beta1.ReplicaSet, opts v1.UpdateOptions) (*v1beta1.ReplicaSet, error)
43 UpdateStatus(ctx context.Context, replicaSet *v1beta1.ReplicaSet, opts v1.UpdateOptions) (*v1beta1.ReplicaSet, error)
44 Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
45 DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
46 Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.ReplicaSet, error)
47 List(ctx context.Context, opts v1.ListOptions) (*v1beta1.ReplicaSetList, error)
48 Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
49 Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.ReplicaSet, err error)
50 GetScale(ctx context.Context, replicaSetName string, options v1.GetOptions) (*v1beta1.Scale, error)
51 UpdateScale(ctx context.Context, replicaSetName string, scale *v1beta1.Scale, opts v1.UpdateOptions) (*v1beta1.Scale, error)
52
53 ReplicaSetExpansion
54}
55
56// replicaSets implements ReplicaSetInterface
57type replicaSets struct {
58 client rest.Interface
59 ns string
60}
61
62// newReplicaSets returns a ReplicaSets
63func newReplicaSets(c *ExtensionsV1beta1Client, namespace string) *replicaSets {
64 return &replicaSets{
65 client: c.RESTClient(),
66 ns: namespace,
67 }
68}
69
70// Get takes name of the replicaSet, and returns the corresponding replicaSet object, and an error if there is any.
71func (c *replicaSets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.ReplicaSet, err error) {
72 result = &v1beta1.ReplicaSet{}
73 err = c.client.Get().
74 Namespace(c.ns).
75 Resource("replicasets").
76 Name(name).
77 VersionedParams(&options, scheme.ParameterCodec).
78 Do(ctx).
79 Into(result)
80 return
81}
82
83// List takes label and field selectors, and returns the list of ReplicaSets that match those selectors.
84func (c *replicaSets) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.ReplicaSetList, err error) {
85 var timeout time.Duration
86 if opts.TimeoutSeconds != nil {
87 timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
88 }
89 result = &v1beta1.ReplicaSetList{}
90 err = c.client.Get().
91 Namespace(c.ns).
92 Resource("replicasets").
93 VersionedParams(&opts, scheme.ParameterCodec).
94 Timeout(timeout).
95 Do(ctx).
96 Into(result)
97 return
98}
99
100// Watch returns a watch.Interface that watches the requested replicaSets.
101func (c *replicaSets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
102 var timeout time.Duration
103 if opts.TimeoutSeconds != nil {
104 timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
105 }
106 opts.Watch = true
107 return c.client.Get().
108 Namespace(c.ns).
109 Resource("replicasets").
110 VersionedParams(&opts, scheme.ParameterCodec).
111 Timeout(timeout).
112 Watch(ctx)
113}
114
115// Create takes the representation of a replicaSet and creates it. Returns the server's representation of the replicaSet, and an error, if there is any.
116func (c *replicaSets) Create(ctx context.Context, replicaSet *v1beta1.ReplicaSet, opts v1.CreateOptions) (result *v1beta1.ReplicaSet, err error) {
117 result = &v1beta1.ReplicaSet{}
118 err = c.client.Post().
119 Namespace(c.ns).
120 Resource("replicasets").
121 VersionedParams(&opts, scheme.ParameterCodec).
122 Body(replicaSet).
123 Do(ctx).
124 Into(result)
125 return
126}
127
128// Update takes the representation of a replicaSet and updates it. Returns the server's representation of the replicaSet, and an error, if there is any.
129func (c *replicaSets) Update(ctx context.Context, replicaSet *v1beta1.ReplicaSet, opts v1.UpdateOptions) (result *v1beta1.ReplicaSet, err error) {
130 result = &v1beta1.ReplicaSet{}
131 err = c.client.Put().
132 Namespace(c.ns).
133 Resource("replicasets").
134 Name(replicaSet.Name).
135 VersionedParams(&opts, scheme.ParameterCodec).
136 Body(replicaSet).
137 Do(ctx).
138 Into(result)
139 return
140}
141
142// UpdateStatus was generated because the type contains a Status member.
143// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
144func (c *replicaSets) UpdateStatus(ctx context.Context, replicaSet *v1beta1.ReplicaSet, opts v1.UpdateOptions) (result *v1beta1.ReplicaSet, err error) {
145 result = &v1beta1.ReplicaSet{}
146 err = c.client.Put().
147 Namespace(c.ns).
148 Resource("replicasets").
149 Name(replicaSet.Name).
150 SubResource("status").
151 VersionedParams(&opts, scheme.ParameterCodec).
152 Body(replicaSet).
153 Do(ctx).
154 Into(result)
155 return
156}
157
158// Delete takes name of the replicaSet and deletes it. Returns an error if one occurs.
159func (c *replicaSets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
160 return c.client.Delete().
161 Namespace(c.ns).
162 Resource("replicasets").
163 Name(name).
164 Body(&opts).
165 Do(ctx).
166 Error()
167}
168
169// DeleteCollection deletes a collection of objects.
170func (c *replicaSets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
171 var timeout time.Duration
172 if listOpts.TimeoutSeconds != nil {
173 timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
174 }
175 return c.client.Delete().
176 Namespace(c.ns).
177 Resource("replicasets").
178 VersionedParams(&listOpts, scheme.ParameterCodec).
179 Timeout(timeout).
180 Body(&opts).
181 Do(ctx).
182 Error()
183}
184
185// Patch applies the patch and returns the patched replicaSet.
186func (c *replicaSets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.ReplicaSet, err error) {
187 result = &v1beta1.ReplicaSet{}
188 err = c.client.Patch(pt).
189 Namespace(c.ns).
190 Resource("replicasets").
191 Name(name).
192 SubResource(subresources...).
193 VersionedParams(&opts, scheme.ParameterCodec).
194 Body(data).
195 Do(ctx).
196 Into(result)
197 return
198}
199
200// GetScale takes name of the replicaSet, and returns the corresponding v1beta1.Scale object, and an error if there is any.
201func (c *replicaSets) GetScale(ctx context.Context, replicaSetName string, options v1.GetOptions) (result *v1beta1.Scale, err error) {
202 result = &v1beta1.Scale{}
203 err = c.client.Get().
204 Namespace(c.ns).
205 Resource("replicasets").
206 Name(replicaSetName).
207 SubResource("scale").
208 VersionedParams(&options, scheme.ParameterCodec).
209 Do(ctx).
210 Into(result)
211 return
212}
213
214// 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.
215func (c *replicaSets) UpdateScale(ctx context.Context, replicaSetName string, scale *v1beta1.Scale, opts v1.UpdateOptions) (result *v1beta1.Scale, err error) {
216 result = &v1beta1.Scale{}
217 err = c.client.Put().
218 Namespace(c.ns).
219 Resource("replicasets").
220 Name(replicaSetName).
221 SubResource("scale").
222 VersionedParams(&opts, scheme.ParameterCodec).
223 Body(scale).
224 Do(ctx).
225 Into(result)
226 return
227}