blob: c7fad108087b2342590f08e63d0ee53aa8823724 [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 v2beta2
20
21import (
22 "context"
23 "time"
24
25 v2beta2 "k8s.io/api/autoscaling/v2beta2"
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// HorizontalPodAutoscalersGetter has a method to return a HorizontalPodAutoscalerInterface.
34// A group's client should implement this interface.
35type HorizontalPodAutoscalersGetter interface {
36 HorizontalPodAutoscalers(namespace string) HorizontalPodAutoscalerInterface
37}
38
39// HorizontalPodAutoscalerInterface has methods to work with HorizontalPodAutoscaler resources.
40type HorizontalPodAutoscalerInterface interface {
41 Create(ctx context.Context, horizontalPodAutoscaler *v2beta2.HorizontalPodAutoscaler, opts v1.CreateOptions) (*v2beta2.HorizontalPodAutoscaler, error)
42 Update(ctx context.Context, horizontalPodAutoscaler *v2beta2.HorizontalPodAutoscaler, opts v1.UpdateOptions) (*v2beta2.HorizontalPodAutoscaler, error)
43 UpdateStatus(ctx context.Context, horizontalPodAutoscaler *v2beta2.HorizontalPodAutoscaler, opts v1.UpdateOptions) (*v2beta2.HorizontalPodAutoscaler, 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) (*v2beta2.HorizontalPodAutoscaler, error)
47 List(ctx context.Context, opts v1.ListOptions) (*v2beta2.HorizontalPodAutoscalerList, 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 *v2beta2.HorizontalPodAutoscaler, err error)
50 HorizontalPodAutoscalerExpansion
51}
52
53// horizontalPodAutoscalers implements HorizontalPodAutoscalerInterface
54type horizontalPodAutoscalers struct {
55 client rest.Interface
56 ns string
57}
58
59// newHorizontalPodAutoscalers returns a HorizontalPodAutoscalers
60func newHorizontalPodAutoscalers(c *AutoscalingV2beta2Client, namespace string) *horizontalPodAutoscalers {
61 return &horizontalPodAutoscalers{
62 client: c.RESTClient(),
63 ns: namespace,
64 }
65}
66
67// Get takes name of the horizontalPodAutoscaler, and returns the corresponding horizontalPodAutoscaler object, and an error if there is any.
68func (c *horizontalPodAutoscalers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2beta2.HorizontalPodAutoscaler, err error) {
69 result = &v2beta2.HorizontalPodAutoscaler{}
70 err = c.client.Get().
71 Namespace(c.ns).
72 Resource("horizontalpodautoscalers").
73 Name(name).
74 VersionedParams(&options, scheme.ParameterCodec).
75 Do(ctx).
76 Into(result)
77 return
78}
79
80// List takes label and field selectors, and returns the list of HorizontalPodAutoscalers that match those selectors.
81func (c *horizontalPodAutoscalers) List(ctx context.Context, opts v1.ListOptions) (result *v2beta2.HorizontalPodAutoscalerList, err error) {
82 var timeout time.Duration
83 if opts.TimeoutSeconds != nil {
84 timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
85 }
86 result = &v2beta2.HorizontalPodAutoscalerList{}
87 err = c.client.Get().
88 Namespace(c.ns).
89 Resource("horizontalpodautoscalers").
90 VersionedParams(&opts, scheme.ParameterCodec).
91 Timeout(timeout).
92 Do(ctx).
93 Into(result)
94 return
95}
96
97// Watch returns a watch.Interface that watches the requested horizontalPodAutoscalers.
98func (c *horizontalPodAutoscalers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
99 var timeout time.Duration
100 if opts.TimeoutSeconds != nil {
101 timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
102 }
103 opts.Watch = true
104 return c.client.Get().
105 Namespace(c.ns).
106 Resource("horizontalpodautoscalers").
107 VersionedParams(&opts, scheme.ParameterCodec).
108 Timeout(timeout).
109 Watch(ctx)
110}
111
112// Create takes the representation of a horizontalPodAutoscaler and creates it. Returns the server's representation of the horizontalPodAutoscaler, and an error, if there is any.
113func (c *horizontalPodAutoscalers) Create(ctx context.Context, horizontalPodAutoscaler *v2beta2.HorizontalPodAutoscaler, opts v1.CreateOptions) (result *v2beta2.HorizontalPodAutoscaler, err error) {
114 result = &v2beta2.HorizontalPodAutoscaler{}
115 err = c.client.Post().
116 Namespace(c.ns).
117 Resource("horizontalpodautoscalers").
118 VersionedParams(&opts, scheme.ParameterCodec).
119 Body(horizontalPodAutoscaler).
120 Do(ctx).
121 Into(result)
122 return
123}
124
125// Update takes the representation of a horizontalPodAutoscaler and updates it. Returns the server's representation of the horizontalPodAutoscaler, and an error, if there is any.
126func (c *horizontalPodAutoscalers) Update(ctx context.Context, horizontalPodAutoscaler *v2beta2.HorizontalPodAutoscaler, opts v1.UpdateOptions) (result *v2beta2.HorizontalPodAutoscaler, err error) {
127 result = &v2beta2.HorizontalPodAutoscaler{}
128 err = c.client.Put().
129 Namespace(c.ns).
130 Resource("horizontalpodautoscalers").
131 Name(horizontalPodAutoscaler.Name).
132 VersionedParams(&opts, scheme.ParameterCodec).
133 Body(horizontalPodAutoscaler).
134 Do(ctx).
135 Into(result)
136 return
137}
138
139// UpdateStatus was generated because the type contains a Status member.
140// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
141func (c *horizontalPodAutoscalers) UpdateStatus(ctx context.Context, horizontalPodAutoscaler *v2beta2.HorizontalPodAutoscaler, opts v1.UpdateOptions) (result *v2beta2.HorizontalPodAutoscaler, err error) {
142 result = &v2beta2.HorizontalPodAutoscaler{}
143 err = c.client.Put().
144 Namespace(c.ns).
145 Resource("horizontalpodautoscalers").
146 Name(horizontalPodAutoscaler.Name).
147 SubResource("status").
148 VersionedParams(&opts, scheme.ParameterCodec).
149 Body(horizontalPodAutoscaler).
150 Do(ctx).
151 Into(result)
152 return
153}
154
155// Delete takes name of the horizontalPodAutoscaler and deletes it. Returns an error if one occurs.
156func (c *horizontalPodAutoscalers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
157 return c.client.Delete().
158 Namespace(c.ns).
159 Resource("horizontalpodautoscalers").
160 Name(name).
161 Body(&opts).
162 Do(ctx).
163 Error()
164}
165
166// DeleteCollection deletes a collection of objects.
167func (c *horizontalPodAutoscalers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
168 var timeout time.Duration
169 if listOpts.TimeoutSeconds != nil {
170 timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
171 }
172 return c.client.Delete().
173 Namespace(c.ns).
174 Resource("horizontalpodautoscalers").
175 VersionedParams(&listOpts, scheme.ParameterCodec).
176 Timeout(timeout).
177 Body(&opts).
178 Do(ctx).
179 Error()
180}
181
182// Patch applies the patch and returns the patched horizontalPodAutoscaler.
183func (c *horizontalPodAutoscalers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2beta2.HorizontalPodAutoscaler, err error) {
184 result = &v2beta2.HorizontalPodAutoscaler{}
185 err = c.client.Patch(pt).
186 Namespace(c.ns).
187 Resource("horizontalpodautoscalers").
188 Name(name).
189 SubResource(subresources...).
190 VersionedParams(&opts, scheme.ParameterCodec).
191 Body(data).
192 Do(ctx).
193 Into(result)
194 return
195}