blob: 55b03d65b2b7d8163bf7e85e61f0b3557aca68fe [file] [log] [blame]
Matteo Scandoloa4285862020-12-01 18:10:10 -08001/*
2Copyright The Kubernetes Authors.
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16
17// Code generated by client-gen. DO NOT EDIT.
18
19package v1
20
21import (
22 "context"
23 "time"
24
25 v1 "k8s.io/api/core/v1"
26 metav1 "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// NamespacesGetter has a method to return a NamespaceInterface.
34// A group's client should implement this interface.
35type NamespacesGetter interface {
36 Namespaces() NamespaceInterface
37}
38
39// NamespaceInterface has methods to work with Namespace resources.
40type NamespaceInterface interface {
41 Create(ctx context.Context, namespace *v1.Namespace, opts metav1.CreateOptions) (*v1.Namespace, error)
42 Update(ctx context.Context, namespace *v1.Namespace, opts metav1.UpdateOptions) (*v1.Namespace, error)
43 UpdateStatus(ctx context.Context, namespace *v1.Namespace, opts metav1.UpdateOptions) (*v1.Namespace, error)
44 Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error
45 Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Namespace, error)
46 List(ctx context.Context, opts metav1.ListOptions) (*v1.NamespaceList, error)
47 Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error)
48 Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Namespace, err error)
49 NamespaceExpansion
50}
51
52// namespaces implements NamespaceInterface
53type namespaces struct {
54 client rest.Interface
55}
56
57// newNamespaces returns a Namespaces
58func newNamespaces(c *CoreV1Client) *namespaces {
59 return &namespaces{
60 client: c.RESTClient(),
61 }
62}
63
64// Get takes name of the namespace, and returns the corresponding namespace object, and an error if there is any.
65func (c *namespaces) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Namespace, err error) {
66 result = &v1.Namespace{}
67 err = c.client.Get().
68 Resource("namespaces").
69 Name(name).
70 VersionedParams(&options, scheme.ParameterCodec).
71 Do(ctx).
72 Into(result)
73 return
74}
75
76// List takes label and field selectors, and returns the list of Namespaces that match those selectors.
77func (c *namespaces) List(ctx context.Context, opts metav1.ListOptions) (result *v1.NamespaceList, err error) {
78 var timeout time.Duration
79 if opts.TimeoutSeconds != nil {
80 timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
81 }
82 result = &v1.NamespaceList{}
83 err = c.client.Get().
84 Resource("namespaces").
85 VersionedParams(&opts, scheme.ParameterCodec).
86 Timeout(timeout).
87 Do(ctx).
88 Into(result)
89 return
90}
91
92// Watch returns a watch.Interface that watches the requested namespaces.
93func (c *namespaces) Watch(ctx context.Context, 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("namespaces").
101 VersionedParams(&opts, scheme.ParameterCodec).
102 Timeout(timeout).
103 Watch(ctx)
104}
105
106// 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.
107func (c *namespaces) Create(ctx context.Context, namespace *v1.Namespace, opts metav1.CreateOptions) (result *v1.Namespace, err error) {
108 result = &v1.Namespace{}
109 err = c.client.Post().
110 Resource("namespaces").
111 VersionedParams(&opts, scheme.ParameterCodec).
112 Body(namespace).
113 Do(ctx).
114 Into(result)
115 return
116}
117
118// 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.
119func (c *namespaces) Update(ctx context.Context, namespace *v1.Namespace, opts metav1.UpdateOptions) (result *v1.Namespace, err error) {
120 result = &v1.Namespace{}
121 err = c.client.Put().
122 Resource("namespaces").
123 Name(namespace.Name).
124 VersionedParams(&opts, scheme.ParameterCodec).
125 Body(namespace).
126 Do(ctx).
127 Into(result)
128 return
129}
130
131// UpdateStatus was generated because the type contains a Status member.
132// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
133func (c *namespaces) UpdateStatus(ctx context.Context, namespace *v1.Namespace, opts metav1.UpdateOptions) (result *v1.Namespace, err error) {
134 result = &v1.Namespace{}
135 err = c.client.Put().
136 Resource("namespaces").
137 Name(namespace.Name).
138 SubResource("status").
139 VersionedParams(&opts, scheme.ParameterCodec).
140 Body(namespace).
141 Do(ctx).
142 Into(result)
143 return
144}
145
146// Delete takes name of the namespace and deletes it. Returns an error if one occurs.
147func (c *namespaces) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
148 return c.client.Delete().
149 Resource("namespaces").
150 Name(name).
151 Body(&opts).
152 Do(ctx).
153 Error()
154}
155
156// Patch applies the patch and returns the patched namespace.
157func (c *namespaces) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Namespace, err error) {
158 result = &v1.Namespace{}
159 err = c.client.Patch(pt).
160 Resource("namespaces").
161 Name(name).
162 SubResource(subresources...).
163 VersionedParams(&opts, scheme.ParameterCodec).
164 Body(data).
165 Do(ctx).
166 Into(result)
167 return
168}