sslobodr | d046be8 | 2019-01-16 10:02:22 -0500 | [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/core/v1" |
| 25 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
| 26 | types "k8s.io/apimachinery/pkg/types" |
| 27 | watch "k8s.io/apimachinery/pkg/watch" |
| 28 | scheme "k8s.io/client-go/kubernetes/scheme" |
| 29 | rest "k8s.io/client-go/rest" |
| 30 | ) |
| 31 | |
| 32 | // PersistentVolumesGetter has a method to return a PersistentVolumeInterface. |
| 33 | // A group's client should implement this interface. |
| 34 | type PersistentVolumesGetter interface { |
| 35 | PersistentVolumes() PersistentVolumeInterface |
| 36 | } |
| 37 | |
| 38 | // PersistentVolumeInterface has methods to work with PersistentVolume resources. |
| 39 | type PersistentVolumeInterface interface { |
| 40 | Create(*v1.PersistentVolume) (*v1.PersistentVolume, error) |
| 41 | Update(*v1.PersistentVolume) (*v1.PersistentVolume, error) |
| 42 | UpdateStatus(*v1.PersistentVolume) (*v1.PersistentVolume, error) |
| 43 | Delete(name string, options *metav1.DeleteOptions) error |
| 44 | DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error |
| 45 | Get(name string, options metav1.GetOptions) (*v1.PersistentVolume, error) |
| 46 | List(opts metav1.ListOptions) (*v1.PersistentVolumeList, error) |
| 47 | Watch(opts metav1.ListOptions) (watch.Interface, error) |
| 48 | Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.PersistentVolume, err error) |
| 49 | PersistentVolumeExpansion |
| 50 | } |
| 51 | |
| 52 | // persistentVolumes implements PersistentVolumeInterface |
| 53 | type persistentVolumes struct { |
| 54 | client rest.Interface |
| 55 | } |
| 56 | |
| 57 | // newPersistentVolumes returns a PersistentVolumes |
| 58 | func newPersistentVolumes(c *CoreV1Client) *persistentVolumes { |
| 59 | return &persistentVolumes{ |
| 60 | client: c.RESTClient(), |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | // Get takes name of the persistentVolume, and returns the corresponding persistentVolume object, and an error if there is any. |
| 65 | func (c *persistentVolumes) Get(name string, options metav1.GetOptions) (result *v1.PersistentVolume, err error) { |
| 66 | result = &v1.PersistentVolume{} |
| 67 | err = c.client.Get(). |
| 68 | Resource("persistentvolumes"). |
| 69 | Name(name). |
| 70 | VersionedParams(&options, scheme.ParameterCodec). |
| 71 | Do(). |
| 72 | Into(result) |
| 73 | return |
| 74 | } |
| 75 | |
| 76 | // List takes label and field selectors, and returns the list of PersistentVolumes that match those selectors. |
| 77 | func (c *persistentVolumes) List(opts metav1.ListOptions) (result *v1.PersistentVolumeList, err error) { |
| 78 | var timeout time.Duration |
| 79 | if opts.TimeoutSeconds != nil { |
| 80 | timeout = time.Duration(*opts.TimeoutSeconds) * time.Second |
| 81 | } |
| 82 | result = &v1.PersistentVolumeList{} |
| 83 | err = c.client.Get(). |
| 84 | Resource("persistentvolumes"). |
| 85 | VersionedParams(&opts, scheme.ParameterCodec). |
| 86 | Timeout(timeout). |
| 87 | Do(). |
| 88 | Into(result) |
| 89 | return |
| 90 | } |
| 91 | |
| 92 | // Watch returns a watch.Interface that watches the requested persistentVolumes. |
| 93 | func (c *persistentVolumes) Watch(opts metav1.ListOptions) (watch.Interface, error) { |
| 94 | var timeout time.Duration |
| 95 | if opts.TimeoutSeconds != nil { |
| 96 | timeout = time.Duration(*opts.TimeoutSeconds) * time.Second |
| 97 | } |
| 98 | opts.Watch = true |
| 99 | return c.client.Get(). |
| 100 | Resource("persistentvolumes"). |
| 101 | VersionedParams(&opts, scheme.ParameterCodec). |
| 102 | Timeout(timeout). |
| 103 | Watch() |
| 104 | } |
| 105 | |
| 106 | // Create takes the representation of a persistentVolume and creates it. Returns the server's representation of the persistentVolume, and an error, if there is any. |
| 107 | func (c *persistentVolumes) Create(persistentVolume *v1.PersistentVolume) (result *v1.PersistentVolume, err error) { |
| 108 | result = &v1.PersistentVolume{} |
| 109 | err = c.client.Post(). |
| 110 | Resource("persistentvolumes"). |
| 111 | Body(persistentVolume). |
| 112 | Do(). |
| 113 | Into(result) |
| 114 | return |
| 115 | } |
| 116 | |
| 117 | // Update takes the representation of a persistentVolume and updates it. Returns the server's representation of the persistentVolume, and an error, if there is any. |
| 118 | func (c *persistentVolumes) Update(persistentVolume *v1.PersistentVolume) (result *v1.PersistentVolume, err error) { |
| 119 | result = &v1.PersistentVolume{} |
| 120 | err = c.client.Put(). |
| 121 | Resource("persistentvolumes"). |
| 122 | Name(persistentVolume.Name). |
| 123 | Body(persistentVolume). |
| 124 | Do(). |
| 125 | Into(result) |
| 126 | return |
| 127 | } |
| 128 | |
| 129 | // UpdateStatus was generated because the type contains a Status member. |
| 130 | // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). |
| 131 | |
| 132 | func (c *persistentVolumes) UpdateStatus(persistentVolume *v1.PersistentVolume) (result *v1.PersistentVolume, err error) { |
| 133 | result = &v1.PersistentVolume{} |
| 134 | err = c.client.Put(). |
| 135 | Resource("persistentvolumes"). |
| 136 | Name(persistentVolume.Name). |
| 137 | SubResource("status"). |
| 138 | Body(persistentVolume). |
| 139 | Do(). |
| 140 | Into(result) |
| 141 | return |
| 142 | } |
| 143 | |
| 144 | // Delete takes name of the persistentVolume and deletes it. Returns an error if one occurs. |
| 145 | func (c *persistentVolumes) Delete(name string, options *metav1.DeleteOptions) error { |
| 146 | return c.client.Delete(). |
| 147 | Resource("persistentvolumes"). |
| 148 | Name(name). |
| 149 | Body(options). |
| 150 | Do(). |
| 151 | Error() |
| 152 | } |
| 153 | |
| 154 | // DeleteCollection deletes a collection of objects. |
| 155 | func (c *persistentVolumes) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error { |
| 156 | var timeout time.Duration |
| 157 | if listOptions.TimeoutSeconds != nil { |
| 158 | timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second |
| 159 | } |
| 160 | return c.client.Delete(). |
| 161 | Resource("persistentvolumes"). |
| 162 | VersionedParams(&listOptions, scheme.ParameterCodec). |
| 163 | Timeout(timeout). |
| 164 | Body(options). |
| 165 | Do(). |
| 166 | Error() |
| 167 | } |
| 168 | |
| 169 | // Patch applies the patch and returns the patched persistentVolume. |
| 170 | func (c *persistentVolumes) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.PersistentVolume, err error) { |
| 171 | result = &v1.PersistentVolume{} |
| 172 | err = c.client.Patch(pt). |
| 173 | Resource("persistentvolumes"). |
| 174 | SubResource(subresources...). |
| 175 | Name(name). |
| 176 | Body(data). |
| 177 | Do(). |
| 178 | Into(result) |
| 179 | return |
| 180 | } |