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