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