github.com/verrazzano/verrazzano@v1.7.0/application-operator/clientset/versioned/fake/clientset_generated.go (about) 1 // Copyright (c) 2021, 2023, Oracle and/or its affiliates. 2 // Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. 3 4 // Code generated by client-gen. DO NOT EDIT. 5 6 package fake 7 8 import ( 9 clientset "github.com/verrazzano/verrazzano/application-operator/clientset/versioned" 10 appv1alpha1 "github.com/verrazzano/verrazzano/application-operator/clientset/versioned/typed/app/v1alpha1" 11 fakeappv1alpha1 "github.com/verrazzano/verrazzano/application-operator/clientset/versioned/typed/app/v1alpha1/fake" 12 clustersv1alpha1 "github.com/verrazzano/verrazzano/application-operator/clientset/versioned/typed/clusters/v1alpha1" 13 fakeclustersv1alpha1 "github.com/verrazzano/verrazzano/application-operator/clientset/versioned/typed/clusters/v1alpha1/fake" 14 oamv1alpha1 "github.com/verrazzano/verrazzano/application-operator/clientset/versioned/typed/oam/v1alpha1" 15 fakeoamv1alpha1 "github.com/verrazzano/verrazzano/application-operator/clientset/versioned/typed/oam/v1alpha1/fake" 16 "k8s.io/apimachinery/pkg/runtime" 17 "k8s.io/apimachinery/pkg/watch" 18 "k8s.io/client-go/discovery" 19 fakediscovery "k8s.io/client-go/discovery/fake" 20 "k8s.io/client-go/testing" 21 ) 22 23 // NewSimpleClientset returns a clientset that will respond with the provided objects. 24 // It's backed by a very simple object tracker that processes creates, updates and deletions as-is, 25 // without applying any validations and/or defaults. It shouldn't be considered a replacement 26 // for a real clientset and is mostly useful in simple unit tests. 27 func NewSimpleClientset(objects ...runtime.Object) *Clientset { 28 o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) 29 for _, obj := range objects { 30 if err := o.Add(obj); err != nil { 31 panic(err) 32 } 33 } 34 35 cs := &Clientset{tracker: o} 36 cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake} 37 cs.AddReactor("*", "*", testing.ObjectReaction(o)) 38 cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) { 39 gvr := action.GetResource() 40 ns := action.GetNamespace() 41 watch, err := o.Watch(gvr, ns) 42 if err != nil { 43 return false, nil, err 44 } 45 return true, watch, nil 46 }) 47 48 return cs 49 } 50 51 // Clientset implements clientset.Interface. Meant to be embedded into a 52 // struct to get a default implementation. This makes faking out just the method 53 // you want to test easier. 54 type Clientset struct { 55 testing.Fake 56 discovery *fakediscovery.FakeDiscovery 57 tracker testing.ObjectTracker 58 } 59 60 func (c *Clientset) Discovery() discovery.DiscoveryInterface { 61 return c.discovery 62 } 63 64 func (c *Clientset) Tracker() testing.ObjectTracker { 65 return c.tracker 66 } 67 68 var ( 69 _ clientset.Interface = &Clientset{} 70 _ testing.FakeClient = &Clientset{} 71 ) 72 73 // AppV1alpha1 retrieves the AppV1alpha1Client 74 func (c *Clientset) AppV1alpha1() appv1alpha1.AppV1alpha1Interface { 75 return &fakeappv1alpha1.FakeAppV1alpha1{Fake: &c.Fake} 76 } 77 78 // ClustersV1alpha1 retrieves the ClustersV1alpha1Client 79 func (c *Clientset) ClustersV1alpha1() clustersv1alpha1.ClustersV1alpha1Interface { 80 return &fakeclustersv1alpha1.FakeClustersV1alpha1{Fake: &c.Fake} 81 } 82 83 // OamV1alpha1 retrieves the OamV1alpha1Client 84 func (c *Clientset) OamV1alpha1() oamv1alpha1.OamV1alpha1Interface { 85 return &fakeoamv1alpha1.FakeOamV1alpha1{Fake: &c.Fake} 86 }