github.com/operator-framework/operator-lifecycle-manager@v0.30.0/pkg/api/client/clientset/versioned/fake/clientset_generated.go (about) 1 /* 2 Copyright Red Hat, Inc. 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 clientset "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned" 23 operatorsv1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1" 24 fakeoperatorsv1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1/fake" 25 operatorsv1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1" 26 fakeoperatorsv1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/fake" 27 operatorsv1alpha2 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha2" 28 fakeoperatorsv1alpha2 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha2/fake" 29 operatorsv2 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v2" 30 fakeoperatorsv2 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v2/fake" 31 "k8s.io/apimachinery/pkg/runtime" 32 "k8s.io/apimachinery/pkg/watch" 33 "k8s.io/client-go/discovery" 34 fakediscovery "k8s.io/client-go/discovery/fake" 35 "k8s.io/client-go/testing" 36 ) 37 38 // NewSimpleClientset returns a clientset that will respond with the provided objects. 39 // It's backed by a very simple object tracker that processes creates, updates and deletions as-is, 40 // without applying any field management, validations and/or defaults. It shouldn't be considered a replacement 41 // for a real clientset and is mostly useful in simple unit tests. 42 // 43 // DEPRECATED: NewClientset replaces this with support for field management, which significantly improves 44 // server side apply testing. NewClientset is only available when apply configurations are generated (e.g. 45 // via --with-applyconfig). 46 func NewSimpleClientset(objects ...runtime.Object) *Clientset { 47 o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) 48 for _, obj := range objects { 49 if err := o.Add(obj); err != nil { 50 panic(err) 51 } 52 } 53 54 cs := &Clientset{tracker: o} 55 cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake} 56 cs.AddReactor("*", "*", testing.ObjectReaction(o)) 57 cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) { 58 gvr := action.GetResource() 59 ns := action.GetNamespace() 60 watch, err := o.Watch(gvr, ns) 61 if err != nil { 62 return false, nil, err 63 } 64 return true, watch, nil 65 }) 66 67 return cs 68 } 69 70 // Clientset implements clientset.Interface. Meant to be embedded into a 71 // struct to get a default implementation. This makes faking out just the method 72 // you want to test easier. 73 type Clientset struct { 74 testing.Fake 75 discovery *fakediscovery.FakeDiscovery 76 tracker testing.ObjectTracker 77 } 78 79 func (c *Clientset) Discovery() discovery.DiscoveryInterface { 80 return c.discovery 81 } 82 83 func (c *Clientset) Tracker() testing.ObjectTracker { 84 return c.tracker 85 } 86 87 var ( 88 _ clientset.Interface = &Clientset{} 89 _ testing.FakeClient = &Clientset{} 90 ) 91 92 // OperatorsV1 retrieves the OperatorsV1Client 93 func (c *Clientset) OperatorsV1() operatorsv1.OperatorsV1Interface { 94 return &fakeoperatorsv1.FakeOperatorsV1{Fake: &c.Fake} 95 } 96 97 // OperatorsV1alpha1 retrieves the OperatorsV1alpha1Client 98 func (c *Clientset) OperatorsV1alpha1() operatorsv1alpha1.OperatorsV1alpha1Interface { 99 return &fakeoperatorsv1alpha1.FakeOperatorsV1alpha1{Fake: &c.Fake} 100 } 101 102 // OperatorsV1alpha2 retrieves the OperatorsV1alpha2Client 103 func (c *Clientset) OperatorsV1alpha2() operatorsv1alpha2.OperatorsV1alpha2Interface { 104 return &fakeoperatorsv1alpha2.FakeOperatorsV1alpha2{Fake: &c.Fake} 105 } 106 107 // OperatorsV2 retrieves the OperatorsV2Client 108 func (c *Clientset) OperatorsV2() operatorsv2.OperatorsV2Interface { 109 return &fakeoperatorsv2.FakeOperatorsV2{Fake: &c.Fake} 110 }