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/apps/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 | DeploymentExpansion |
| 51 | } |
| 52 | |
| 53 | // deployments implements DeploymentInterface |
| 54 | type deployments struct { |
| 55 | client rest.Interface |
| 56 | ns string |
| 57 | } |
| 58 | |
| 59 | // newDeployments returns a Deployments |
| 60 | func newDeployments(c *AppsV1beta1Client, namespace string) *deployments { |
| 61 | return &deployments{ |
| 62 | client: c.RESTClient(), |
| 63 | ns: namespace, |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | // Get takes name of the deployment, and returns the corresponding deployment object, and an error if there is any. |
| 68 | func (c *deployments) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.Deployment, err error) { |
| 69 | result = &v1beta1.Deployment{} |
| 70 | err = c.client.Get(). |
| 71 | Namespace(c.ns). |
| 72 | Resource("deployments"). |
| 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 Deployments that match those selectors. |
| 81 | func (c *deployments) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.DeploymentList, err error) { |
| 82 | var timeout time.Duration |
| 83 | if opts.TimeoutSeconds != nil { |
| 84 | timeout = time.Duration(*opts.TimeoutSeconds) * time.Second |
| 85 | } |
| 86 | result = &v1beta1.DeploymentList{} |
| 87 | err = c.client.Get(). |
| 88 | Namespace(c.ns). |
| 89 | Resource("deployments"). |
| 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 deployments. |
| 98 | func (c *deployments) 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("deployments"). |
| 107 | VersionedParams(&opts, scheme.ParameterCodec). |
| 108 | Timeout(timeout). |
| 109 | Watch(ctx) |
| 110 | } |
| 111 | |
| 112 | // 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. |
| 113 | func (c *deployments) Create(ctx context.Context, deployment *v1beta1.Deployment, opts v1.CreateOptions) (result *v1beta1.Deployment, err error) { |
| 114 | result = &v1beta1.Deployment{} |
| 115 | err = c.client.Post(). |
| 116 | Namespace(c.ns). |
| 117 | Resource("deployments"). |
| 118 | VersionedParams(&opts, scheme.ParameterCodec). |
| 119 | Body(deployment). |
| 120 | Do(ctx). |
| 121 | Into(result) |
| 122 | return |
| 123 | } |
| 124 | |
| 125 | // 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. |
| 126 | func (c *deployments) Update(ctx context.Context, deployment *v1beta1.Deployment, opts v1.UpdateOptions) (result *v1beta1.Deployment, err error) { |
| 127 | result = &v1beta1.Deployment{} |
| 128 | err = c.client.Put(). |
| 129 | Namespace(c.ns). |
| 130 | Resource("deployments"). |
| 131 | Name(deployment.Name). |
| 132 | VersionedParams(&opts, scheme.ParameterCodec). |
| 133 | Body(deployment). |
| 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(). |
| 141 | func (c *deployments) UpdateStatus(ctx context.Context, deployment *v1beta1.Deployment, opts v1.UpdateOptions) (result *v1beta1.Deployment, err error) { |
| 142 | result = &v1beta1.Deployment{} |
| 143 | err = c.client.Put(). |
| 144 | Namespace(c.ns). |
| 145 | Resource("deployments"). |
| 146 | Name(deployment.Name). |
| 147 | SubResource("status"). |
| 148 | VersionedParams(&opts, scheme.ParameterCodec). |
| 149 | Body(deployment). |
| 150 | Do(ctx). |
| 151 | Into(result) |
| 152 | return |
| 153 | } |
| 154 | |
| 155 | // Delete takes name of the deployment and deletes it. Returns an error if one occurs. |
| 156 | func (c *deployments) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { |
| 157 | return c.client.Delete(). |
| 158 | Namespace(c.ns). |
| 159 | Resource("deployments"). |
| 160 | Name(name). |
| 161 | Body(&opts). |
| 162 | Do(ctx). |
| 163 | Error() |
| 164 | } |
| 165 | |
| 166 | // DeleteCollection deletes a collection of objects. |
| 167 | func (c *deployments) 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("deployments"). |
| 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 deployment. |
| 183 | func (c *deployments) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.Deployment, err error) { |
| 184 | result = &v1beta1.Deployment{} |
| 185 | err = c.client.Patch(pt). |
| 186 | Namespace(c.ns). |
| 187 | Resource("deployments"). |
| 188 | Name(name). |
| 189 | SubResource(subresources...). |
| 190 | VersionedParams(&opts, scheme.ParameterCodec). |
| 191 | Body(data). |
| 192 | Do(ctx). |
| 193 | Into(result) |
| 194 | return |
| 195 | } |