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