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