Matthias Andreas Benkard | 832a54e | 2019-01-29 09:27:38 +0100 | [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 | v1 "k8s.io/api/core/v1" |
| 23 | meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
| 24 | types "k8s.io/apimachinery/pkg/types" |
| 25 | watch "k8s.io/apimachinery/pkg/watch" |
| 26 | scheme "k8s.io/client-go/kubernetes/scheme" |
| 27 | rest "k8s.io/client-go/rest" |
| 28 | ) |
| 29 | |
| 30 | // NamespacesGetter has a method to return a NamespaceInterface. |
| 31 | // A group's client should implement this interface. |
| 32 | type NamespacesGetter interface { |
| 33 | Namespaces() NamespaceInterface |
| 34 | } |
| 35 | |
| 36 | // NamespaceInterface has methods to work with Namespace resources. |
| 37 | type NamespaceInterface interface { |
| 38 | Create(*v1.Namespace) (*v1.Namespace, error) |
| 39 | Update(*v1.Namespace) (*v1.Namespace, error) |
| 40 | UpdateStatus(*v1.Namespace) (*v1.Namespace, error) |
| 41 | Delete(name string, options *meta_v1.DeleteOptions) error |
| 42 | Get(name string, options meta_v1.GetOptions) (*v1.Namespace, error) |
| 43 | List(opts meta_v1.ListOptions) (*v1.NamespaceList, error) |
| 44 | Watch(opts meta_v1.ListOptions) (watch.Interface, error) |
| 45 | Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Namespace, err error) |
| 46 | NamespaceExpansion |
| 47 | } |
| 48 | |
| 49 | // namespaces implements NamespaceInterface |
| 50 | type namespaces struct { |
| 51 | client rest.Interface |
| 52 | } |
| 53 | |
| 54 | // newNamespaces returns a Namespaces |
| 55 | func newNamespaces(c *CoreV1Client) *namespaces { |
| 56 | return &namespaces{ |
| 57 | client: c.RESTClient(), |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | // Get takes name of the namespace, and returns the corresponding namespace object, and an error if there is any. |
| 62 | func (c *namespaces) Get(name string, options meta_v1.GetOptions) (result *v1.Namespace, err error) { |
| 63 | result = &v1.Namespace{} |
| 64 | err = c.client.Get(). |
| 65 | Resource("namespaces"). |
| 66 | Name(name). |
| 67 | VersionedParams(&options, scheme.ParameterCodec). |
| 68 | Do(). |
| 69 | Into(result) |
| 70 | return |
| 71 | } |
| 72 | |
| 73 | // List takes label and field selectors, and returns the list of Namespaces that match those selectors. |
| 74 | func (c *namespaces) List(opts meta_v1.ListOptions) (result *v1.NamespaceList, err error) { |
| 75 | result = &v1.NamespaceList{} |
| 76 | err = c.client.Get(). |
| 77 | Resource("namespaces"). |
| 78 | VersionedParams(&opts, scheme.ParameterCodec). |
| 79 | Do(). |
| 80 | Into(result) |
| 81 | return |
| 82 | } |
| 83 | |
| 84 | // Watch returns a watch.Interface that watches the requested namespaces. |
| 85 | func (c *namespaces) Watch(opts meta_v1.ListOptions) (watch.Interface, error) { |
| 86 | opts.Watch = true |
| 87 | return c.client.Get(). |
| 88 | Resource("namespaces"). |
| 89 | VersionedParams(&opts, scheme.ParameterCodec). |
| 90 | Watch() |
| 91 | } |
| 92 | |
| 93 | // Create takes the representation of a namespace and creates it. Returns the server's representation of the namespace, and an error, if there is any. |
| 94 | func (c *namespaces) Create(namespace *v1.Namespace) (result *v1.Namespace, err error) { |
| 95 | result = &v1.Namespace{} |
| 96 | err = c.client.Post(). |
| 97 | Resource("namespaces"). |
| 98 | Body(namespace). |
| 99 | Do(). |
| 100 | Into(result) |
| 101 | return |
| 102 | } |
| 103 | |
| 104 | // Update takes the representation of a namespace and updates it. Returns the server's representation of the namespace, and an error, if there is any. |
| 105 | func (c *namespaces) Update(namespace *v1.Namespace) (result *v1.Namespace, err error) { |
| 106 | result = &v1.Namespace{} |
| 107 | err = c.client.Put(). |
| 108 | Resource("namespaces"). |
| 109 | Name(namespace.Name). |
| 110 | Body(namespace). |
| 111 | Do(). |
| 112 | Into(result) |
| 113 | return |
| 114 | } |
| 115 | |
| 116 | // UpdateStatus was generated because the type contains a Status member. |
| 117 | // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). |
| 118 | |
| 119 | func (c *namespaces) UpdateStatus(namespace *v1.Namespace) (result *v1.Namespace, err error) { |
| 120 | result = &v1.Namespace{} |
| 121 | err = c.client.Put(). |
| 122 | Resource("namespaces"). |
| 123 | Name(namespace.Name). |
| 124 | SubResource("status"). |
| 125 | Body(namespace). |
| 126 | Do(). |
| 127 | Into(result) |
| 128 | return |
| 129 | } |
| 130 | |
| 131 | // Delete takes name of the namespace and deletes it. Returns an error if one occurs. |
| 132 | func (c *namespaces) Delete(name string, options *meta_v1.DeleteOptions) error { |
| 133 | return c.client.Delete(). |
| 134 | Resource("namespaces"). |
| 135 | Name(name). |
| 136 | Body(options). |
| 137 | Do(). |
| 138 | Error() |
| 139 | } |
| 140 | |
| 141 | // Patch applies the patch and returns the patched namespace. |
| 142 | func (c *namespaces) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Namespace, err error) { |
| 143 | result = &v1.Namespace{} |
| 144 | err = c.client.Patch(pt). |
| 145 | Resource("namespaces"). |
| 146 | SubResource(subresources...). |
| 147 | Name(name). |
| 148 | Body(data). |
| 149 | Do(). |
| 150 | Into(result) |
| 151 | return |
| 152 | } |