Debian Codegraph @

kubernetes/typed/resource/v1beta2/resource_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 v1beta2
20
21 import (
22 http "net/http"
23
24 resourcev1beta2 "k8s.io/api/resource/v1beta2"
25 scheme "k8s.io/client-go/kubernetes/scheme"
26 rest "k8s.io/client-go/rest"
27 )
28
29 type ResourceV1beta2Interface interface {
30 RESTClient() rest.Interface
31 DeviceClassesGetter
32 ResourceClaimsGetter
33 ResourceClaimTemplatesGetter
34 ResourceSlicesGetter
35 }
36
37 // ResourceV1beta2Client is used to interact with features provided by the resource.k8s.io group.
38 type ResourceV1beta2Client struct {
39 restClient rest.Interface
40 }
41
42 func (c *ResourceV1beta2Client) DeviceClasses() DeviceClassInterface {
43 return newDeviceClasses(c)
44 }
45
46 func (c *ResourceV1beta2Client) ResourceClaims(namespace string) ResourceClaimInterface {
47 return newResourceClaims(c, namespace)
48 }
49
50 func (c *ResourceV1beta2Client) ResourceClaimTemplates(namespace string) ResourceClaimTemplateInterface {
51 return newResourceClaimTemplates(c, namespace)
52 }
53
54 func (c *ResourceV1beta2Client) ResourceSlices() ResourceSliceInterface {
55 return newResourceSlices(c)
56 }
57
58 // NewForConfig creates a new ResourceV1beta2Client for the given config.
59 // NewForConfig is equivalent to NewForConfigAndClient(c, httpClient),
60 // where httpClient was generated with rest.HTTPClientFor(c).
61 func NewForConfig(c *rest.Config) (*ResourceV1beta2Client, error) {
62 config := *c
63 setConfigDefaults(&config)
64 httpClient, err := rest.HTTPClientFor(&config)
65 if err != nil {
66 return nil, err
67 }
68 return NewForConfigAndClient(&config, httpClient)
69 }
70
71 // NewForConfigAndClient creates a new ResourceV1beta2Client for the given config and http client.
72 // Note the http client provided takes precedence over the configured transport values.
73 func NewForConfigAndClient(c *rest.Config, h *http.Client) (*ResourceV1beta2Client, error) {
74 config := *c
75 setConfigDefaults(&config)
76 client, err := rest.RESTClientForConfigAndClient(&config, h)
77 if err != nil {
78 return nil, err
79 }
80 return &ResourceV1beta2Client{client}, nil
81 }
82
83 // NewForConfigOrDie creates a new ResourceV1beta2Client for the given config and
84 // panics if there is an error in the config.
85 func NewForConfigOrDie(c *rest.Config) *ResourceV1beta2Client {
86 client, err := NewForConfig(c)
87 if err != nil {
88 panic(err)
89 }
90 return client
91 }
92
93 // New creates a new ResourceV1beta2Client for the given RESTClient.
94 func New(c rest.Interface) *ResourceV1beta2Client {
95 return &ResourceV1beta2Client{c}
96 }
97
98 func setConfigDefaults(config *rest.Config) {
99 gv := resourcev1beta2.SchemeGroupVersion
100 config.GroupVersion = &gv
101 config.APIPath = "/apis"
102 config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, scheme.Codecs).WithoutConversion()
103
104 if config.UserAgent == "" {
105 config.UserAgent = rest.DefaultKubernetesUserAgent()
106 }
107 }
108
109 // RESTClient returns a RESTClient that is used to communicate
110 // with API server by this client implementation.
111 func (c *ResourceV1beta2Client) RESTClient() rest.Interface {
112 if c == nil {
113 return nil
114 }
115 return c.restClient
116 }