Matteo Scandolo | a428586 | 2020-12-01 18:10:10 -0800 | [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 v1beta1 |
| 20 | |
| 21 | import ( |
| 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 | // DeploymentsGetter has a method to return a DeploymentInterface. |
| 34 | // A group's client should implement this interface. |
| 35 | type DeploymentsGetter interface { |
| 36 | Deployments(namespace string) DeploymentInterface |
| 37 | } |
| 38 | |
| 39 | // DeploymentInterface has methods to work with Deployment resources. |
| 40 | type DeploymentInterface interface { |
| 41 | Create(ctx context.Context, deployment *v1beta1.Deployment, opts v1.CreateOptions) (*v1beta1.Deployment, error) |
| 42 | Update(ctx context.Context, deployment *v1beta1.Deployment, opts v1.UpdateOptions) (*v1beta1.Deployment, error) |
| 43 | UpdateStatus(ctx context.Context, deployment *v1beta1.Deployment, opts v1.UpdateOptions) (*v1beta1.Deployment, 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.Deployment, error) |
| 47 | List(ctx context.Context, opts v1.ListOptions) (*v1beta1.DeploymentList, 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.Deployment, err error) |
| 50 | GetScale(ctx context.Context, deploymentName string, options v1.GetOptions) (*v1beta1.Scale, error) |
| 51 | UpdateScale(ctx context.Context, deploymentName string, scale *v1beta1.Scale, opts v1.UpdateOptions) (*v1beta1.Scale, error) |
| 52 | |
| 53 | DeploymentExpansion |
| 54 | } |
| 55 | |
| 56 | // deployments implements DeploymentInterface |
| 57 | type deployments struct { |
| 58 | client rest.Interface |
| 59 | ns string |
| 60 | } |
| 61 | |
| 62 | // newDeployments returns a Deployments |
| 63 | func newDeployments(c *ExtensionsV1beta1Client, namespace string) *deployments { |
| 64 | return &deployments{ |
| 65 | client: c.RESTClient(), |
| 66 | ns: namespace, |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | // Get takes name of the deployment, and returns the corresponding deployment object, and an error if there is any. |
| 71 | func (c *deployments) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.Deployment, err error) { |
| 72 | result = &v1beta1.Deployment{} |
| 73 | err = c.client.Get(). |
| 74 | Namespace(c.ns). |
| 75 | Resource("deployments"). |
| 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 Deployments that match those selectors. |
| 84 | func (c *deployments) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.DeploymentList, err error) { |
| 85 | var timeout time.Duration |
| 86 | if opts.TimeoutSeconds != nil { |
| 87 | timeout = time.Duration(*opts.TimeoutSeconds) * time.Second |
| 88 | } |
| 89 | result = &v1beta1.DeploymentList{} |
| 90 | err = c.client.Get(). |
| 91 | Namespace(c.ns). |
| 92 | Resource("deployments"). |
| 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 deployments. |
| 101 | func (c *deployments) 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("deployments"). |
| 110 | VersionedParams(&opts, scheme.ParameterCodec). |
| 111 | Timeout(timeout). |
| 112 | Watch(ctx) |
| 113 | } |
| 114 | |
| 115 | // Create takes the representation of a deployment and creates it. Returns the server's representation of the deployment, and an error, if there is any. |
| 116 | func (c *deployments) Create(ctx context.Context, deployment *v1beta1.Deployment, opts v1.CreateOptions) (result *v1beta1.Deployment, err error) { |
| 117 | result = &v1beta1.Deployment{} |
| 118 | err = c.client.Post(). |
| 119 | Namespace(c.ns). |
| 120 | Resource("deployments"). |
| 121 | VersionedParams(&opts, scheme.ParameterCodec). |
| 122 | Body(deployment). |
| 123 | Do(ctx). |
| 124 | Into(result) |
| 125 | return |
| 126 | } |
| 127 | |
| 128 | // Update takes the representation of a deployment and updates it. Returns the server's representation of the deployment, and an error, if there is any. |
| 129 | func (c *deployments) Update(ctx context.Context, deployment *v1beta1.Deployment, opts v1.UpdateOptions) (result *v1beta1.Deployment, err error) { |
| 130 | result = &v1beta1.Deployment{} |
| 131 | err = c.client.Put(). |
| 132 | Namespace(c.ns). |
| 133 | Resource("deployments"). |
| 134 | Name(deployment.Name). |
| 135 | VersionedParams(&opts, scheme.ParameterCodec). |
| 136 | Body(deployment). |
| 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(). |
| 144 | func (c *deployments) UpdateStatus(ctx context.Context, deployment *v1beta1.Deployment, opts v1.UpdateOptions) (result *v1beta1.Deployment, err error) { |
| 145 | result = &v1beta1.Deployment{} |
| 146 | err = c.client.Put(). |
| 147 | Namespace(c.ns). |
| 148 | Resource("deployments"). |
| 149 | Name(deployment.Name). |
| 150 | SubResource("status"). |
| 151 | VersionedParams(&opts, scheme.ParameterCodec). |
| 152 | Body(deployment). |
| 153 | Do(ctx). |
| 154 | Into(result) |
| 155 | return |
| 156 | } |
| 157 | |
| 158 | // Delete takes name of the deployment and deletes it. Returns an error if one occurs. |
| 159 | func (c *deployments) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { |
| 160 | return c.client.Delete(). |
| 161 | Namespace(c.ns). |
| 162 | Resource("deployments"). |
| 163 | Name(name). |
| 164 | Body(&opts). |
| 165 | Do(ctx). |
| 166 | Error() |
| 167 | } |
| 168 | |
| 169 | // DeleteCollection deletes a collection of objects. |
| 170 | func (c *deployments) 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("deployments"). |
| 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 deployment. |
| 186 | func (c *deployments) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.Deployment, err error) { |
| 187 | result = &v1beta1.Deployment{} |
| 188 | err = c.client.Patch(pt). |
| 189 | Namespace(c.ns). |
| 190 | Resource("deployments"). |
| 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 deployment, and returns the corresponding v1beta1.Scale object, and an error if there is any. |
| 201 | func (c *deployments) GetScale(ctx context.Context, deploymentName string, options v1.GetOptions) (result *v1beta1.Scale, err error) { |
| 202 | result = &v1beta1.Scale{} |
| 203 | err = c.client.Get(). |
| 204 | Namespace(c.ns). |
| 205 | Resource("deployments"). |
| 206 | Name(deploymentName). |
| 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. |
| 215 | func (c *deployments) UpdateScale(ctx context.Context, deploymentName 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("deployments"). |
| 220 | Name(deploymentName). |
| 221 | SubResource("scale"). |
| 222 | VersionedParams(&opts, scheme.ParameterCodec). |
| 223 | Body(scale). |
| 224 | Do(ctx). |
| 225 | Into(result) |
| 226 | return |
| 227 | } |