2 Copyright The Kubernetes Authors.
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
8 http://www.apache.org/licenses/LICENSE-2.0
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.
17 // Code generated by client-gen. DO NOT EDIT.
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"
32 // NamespacesGetter has a method to return a NamespaceInterface.
33 // A group's client should implement this interface.
34 type NamespacesGetter interface {
35 Namespaces() NamespaceInterface
38 // NamespaceInterface has methods to work with Namespace resources.
39 type NamespaceInterface interface {
40 Create(*v1.Namespace) (*v1.Namespace, error)
41 Update(*v1.Namespace) (*v1.Namespace, error)
42 UpdateStatus(*v1.Namespace) (*v1.Namespace, error)
43 Delete(name string, options *metav1.DeleteOptions) error
44 Get(name string, options metav1.GetOptions) (*v1.Namespace, error)
45 List(opts metav1.ListOptions) (*v1.NamespaceList, error)
46 Watch(opts metav1.ListOptions) (watch.Interface, error)
47 Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Namespace, err error)
51 // namespaces implements NamespaceInterface
52 type namespaces struct {
56 // newNamespaces returns a Namespaces
57 func newNamespaces(c *CoreV1Client) *namespaces {
59 client: c.RESTClient(),
63 // Get takes name of the namespace, and returns the corresponding namespace object, and an error if there is any.
64 func (c *namespaces) Get(name string, options metav1.GetOptions) (result *v1.Namespace, err error) {
65 result = &v1.Namespace{}
67 Resource("namespaces").
69 VersionedParams(&options, scheme.ParameterCodec).
75 // List takes label and field selectors, and returns the list of Namespaces that match those selectors.
76 func (c *namespaces) List(opts metav1.ListOptions) (result *v1.NamespaceList, err error) {
77 var timeout time.Duration
78 if opts.TimeoutSeconds != nil {
79 timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
81 result = &v1.NamespaceList{}
83 Resource("namespaces").
84 VersionedParams(&opts, scheme.ParameterCodec).
91 // Watch returns a watch.Interface that watches the requested namespaces.
92 func (c *namespaces) Watch(opts metav1.ListOptions) (watch.Interface, error) {
93 var timeout time.Duration
94 if opts.TimeoutSeconds != nil {
95 timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
98 return c.client.Get().
99 Resource("namespaces").
100 VersionedParams(&opts, scheme.ParameterCodec).
105 // 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.
106 func (c *namespaces) Create(namespace *v1.Namespace) (result *v1.Namespace, err error) {
107 result = &v1.Namespace{}
108 err = c.client.Post().
109 Resource("namespaces").
116 // 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.
117 func (c *namespaces) Update(namespace *v1.Namespace) (result *v1.Namespace, err error) {
118 result = &v1.Namespace{}
119 err = c.client.Put().
120 Resource("namespaces").
121 Name(namespace.Name).
128 // UpdateStatus was generated because the type contains a Status member.
129 // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
131 func (c *namespaces) UpdateStatus(namespace *v1.Namespace) (result *v1.Namespace, err error) {
132 result = &v1.Namespace{}
133 err = c.client.Put().
134 Resource("namespaces").
135 Name(namespace.Name).
136 SubResource("status").
143 // Delete takes name of the namespace and deletes it. Returns an error if one occurs.
144 func (c *namespaces) Delete(name string, options *metav1.DeleteOptions) error {
145 return c.client.Delete().
146 Resource("namespaces").
153 // Patch applies the patch and returns the patched namespace.
154 func (c *namespaces) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Namespace, err error) {
155 result = &v1.Namespace{}
156 err = c.client.Patch(pt).
157 Resource("namespaces").
158 SubResource(subresources...).