sigs.k8s.io/gateway-api@v1.0.0/pkg/client/clientset/versioned/fake/clientset_generated.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 fake 20 21 import ( 22 "k8s.io/apimachinery/pkg/runtime" 23 "k8s.io/apimachinery/pkg/watch" 24 "k8s.io/client-go/discovery" 25 fakediscovery "k8s.io/client-go/discovery/fake" 26 "k8s.io/client-go/testing" 27 clientset "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned" 28 gatewayv1 "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1" 29 fakegatewayv1 "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/fake" 30 gatewayv1alpha2 "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2" 31 fakegatewayv1alpha2 "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake" 32 gatewayv1beta1 "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1beta1" 33 fakegatewayv1beta1 "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1beta1/fake" 34 ) 35 36 // NewSimpleClientset returns a clientset that will respond with the provided objects. 37 // It's backed by a very simple object tracker that processes creates, updates and deletions as-is, 38 // without applying any validations and/or defaults. It shouldn't be considered a replacement 39 // for a real clientset and is mostly useful in simple unit tests. 40 func NewSimpleClientset(objects ...runtime.Object) *Clientset { 41 o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) 42 for _, obj := range objects { 43 if err := o.Add(obj); err != nil { 44 panic(err) 45 } 46 } 47 48 cs := &Clientset{tracker: o} 49 cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake} 50 cs.AddReactor("*", "*", testing.ObjectReaction(o)) 51 cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) { 52 gvr := action.GetResource() 53 ns := action.GetNamespace() 54 watch, err := o.Watch(gvr, ns) 55 if err != nil { 56 return false, nil, err 57 } 58 return true, watch, nil 59 }) 60 61 return cs 62 } 63 64 // Clientset implements clientset.Interface. Meant to be embedded into a 65 // struct to get a default implementation. This makes faking out just the method 66 // you want to test easier. 67 type Clientset struct { 68 testing.Fake 69 discovery *fakediscovery.FakeDiscovery 70 tracker testing.ObjectTracker 71 } 72 73 func (c *Clientset) Discovery() discovery.DiscoveryInterface { 74 return c.discovery 75 } 76 77 func (c *Clientset) Tracker() testing.ObjectTracker { 78 return c.tracker 79 } 80 81 var ( 82 _ clientset.Interface = &Clientset{} 83 _ testing.FakeClient = &Clientset{} 84 ) 85 86 // GatewayV1alpha2 retrieves the GatewayV1alpha2Client 87 func (c *Clientset) GatewayV1alpha2() gatewayv1alpha2.GatewayV1alpha2Interface { 88 return &fakegatewayv1alpha2.FakeGatewayV1alpha2{Fake: &c.Fake} 89 } 90 91 // GatewayV1beta1 retrieves the GatewayV1beta1Client 92 func (c *Clientset) GatewayV1beta1() gatewayv1beta1.GatewayV1beta1Interface { 93 return &fakegatewayv1beta1.FakeGatewayV1beta1{Fake: &c.Fake} 94 } 95 96 // GatewayV1 retrieves the GatewayV1Client 97 func (c *Clientset) GatewayV1() gatewayv1.GatewayV1Interface { 98 return &fakegatewayv1.FakeGatewayV1{Fake: &c.Fake} 99 }