k8s.io/client-go@v0.22.2/kubernetes/typed/autoscaling/v2beta2/autoscaling_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 v2beta2 20 21 import ( 22 v2beta2 "k8s.io/api/autoscaling/v2beta2" 23 "k8s.io/client-go/kubernetes/scheme" 24 rest "k8s.io/client-go/rest" 25 ) 26 27 type AutoscalingV2beta2Interface interface { 28 RESTClient() rest.Interface 29 HorizontalPodAutoscalersGetter 30 } 31 32 // AutoscalingV2beta2Client is used to interact with features provided by the autoscaling group. 33 type AutoscalingV2beta2Client struct { 34 restClient rest.Interface 35 } 36 37 func (c *AutoscalingV2beta2Client) HorizontalPodAutoscalers(namespace string) HorizontalPodAutoscalerInterface { 38 return newHorizontalPodAutoscalers(c, namespace) 39 } 40 41 // NewForConfig creates a new AutoscalingV2beta2Client for the given config. 42 func NewForConfig(c *rest.Config) (*AutoscalingV2beta2Client, error) { 43 config := *c 44 if err := setConfigDefaults(&config); err != nil { 45 return nil, err 46 } 47 client, err := rest.RESTClientFor(&config) 48 if err != nil { 49 return nil, err 50 } 51 return &AutoscalingV2beta2Client{client}, nil 52 } 53 54 // NewForConfigOrDie creates a new AutoscalingV2beta2Client for the given config and 55 // panics if there is an error in the config. 56 func NewForConfigOrDie(c *rest.Config) *AutoscalingV2beta2Client { 57 client, err := NewForConfig(c) 58 if err != nil { 59 panic(err) 60 } 61 return client 62 } 63 64 // New creates a new AutoscalingV2beta2Client for the given RESTClient. 65 func New(c rest.Interface) *AutoscalingV2beta2Client { 66 return &AutoscalingV2beta2Client{c} 67 } 68 69 func setConfigDefaults(config *rest.Config) error { 70 gv := v2beta2.SchemeGroupVersion 71 config.GroupVersion = &gv 72 config.APIPath = "/apis" 73 config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() 74 75 if config.UserAgent == "" { 76 config.UserAgent = rest.DefaultKubernetesUserAgent() 77 } 78 79 return nil 80 } 81 82 // RESTClient returns a RESTClient that is used to communicate 83 // with API server by this client implementation. 84 func (c *AutoscalingV2beta2Client) RESTClient() rest.Interface { 85 if c == nil { 86 return nil 87 } 88 return c.restClient 89 }