Debian Codegraph @

kubernetes/typed/node/v1beta1/node_client.go

raw symbols SCIP
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 v1beta1
20
21 import (
22 http "net/http"
23
24 nodev1beta1 "k8s.io/api/node/v1beta1"
25 scheme "k8s.io/client-go/kubernetes/scheme"
26 rest "k8s.io/client-go/rest"
27 )
28
29 type NodeV1beta1Interface interface {
30 RESTClient() rest.Interface
31 RuntimeClassesGetter
32 }
33
34 // NodeV1beta1Client is used to interact with features provided by the node.k8s.io group.
35 type NodeV1beta1Client struct {
36 restClient rest.Interface
37 }
38
39 func (c *NodeV1beta1Client) RuntimeClasses() RuntimeClassInterface {
40 return newRuntimeClasses(c)
41 }
42
43 // NewForConfig creates a new NodeV1beta1Client for the given config.
44 // NewForConfig is equivalent to NewForConfigAndClient(c, httpClient),
45 // where httpClient was generated with rest.HTTPClientFor(c).
46 func NewForConfig(c *rest.Config) (*NodeV1beta1Client, error) {
47 config := *c
48 setConfigDefaults(&config)
49 httpClient, err := rest.HTTPClientFor(&config)
50 if err != nil {
51 return nil, err
52 }
53 return NewForConfigAndClient(&config, httpClient)
54 }
55
56 // NewForConfigAndClient creates a new NodeV1beta1Client for the given config and http client.
57 // Note the http client provided takes precedence over the configured transport values.
58 func NewForConfigAndClient(c *rest.Config, h *http.Client) (*NodeV1beta1Client, error) {
59 config := *c
60 setConfigDefaults(&config)
61 client, err := rest.RESTClientForConfigAndClient(&config, h)
62 if err != nil {
63 return nil, err
64 }
65 return &NodeV1beta1Client{client}, nil
66 }
67
68 // NewForConfigOrDie creates a new NodeV1beta1Client for the given config and
69 // panics if there is an error in the config.
70 func NewForConfigOrDie(c *rest.Config) *NodeV1beta1Client {
71 client, err := NewForConfig(c)
72 if err != nil {
73 panic(err)
74 }
75 return client
76 }
77
78 // New creates a new NodeV1beta1Client for the given RESTClient.
79 func New(c rest.Interface) *NodeV1beta1Client {
80 return &NodeV1beta1Client{c}
81 }
82
83 func setConfigDefaults(config *rest.Config) {
84 gv := nodev1beta1.SchemeGroupVersion
85 config.GroupVersion = &gv
86 config.APIPath = "/apis"
87 config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, scheme.Codecs).WithoutConversion()
88
89 if config.UserAgent == "" {
90 config.UserAgent = rest.DefaultKubernetesUserAgent()
91 }
92 }
93
94 // RESTClient returns a RESTClient that is used to communicate
95 // with API server by this client implementation.
96 func (c *NodeV1beta1Client) RESTClient() rest.Interface {
97 if c == nil {
98 return nil
99 }
100 return c.restClient
101 }