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