github.com/1aal/kubeblocks@v0.0.0-20231107070852-e1c03e598921/pkg/client/clientset/versioned/fake/clientset_generated.go (about) 1 /* 2 Copyright (C) 2022-2023 ApeCloud Co., Ltd 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/1aal/kubeblocks/pkg/client/clientset/versioned" 23 appsv1alpha1 "github.com/1aal/kubeblocks/pkg/client/clientset/versioned/typed/apps/v1alpha1" 24 fakeappsv1alpha1 "github.com/1aal/kubeblocks/pkg/client/clientset/versioned/typed/apps/v1alpha1/fake" 25 dataprotectionv1alpha1 "github.com/1aal/kubeblocks/pkg/client/clientset/versioned/typed/dataprotection/v1alpha1" 26 fakedataprotectionv1alpha1 "github.com/1aal/kubeblocks/pkg/client/clientset/versioned/typed/dataprotection/v1alpha1/fake" 27 extensionsv1alpha1 "github.com/1aal/kubeblocks/pkg/client/clientset/versioned/typed/extensions/v1alpha1" 28 fakeextensionsv1alpha1 "github.com/1aal/kubeblocks/pkg/client/clientset/versioned/typed/extensions/v1alpha1/fake" 29 storagev1alpha1 "github.com/1aal/kubeblocks/pkg/client/clientset/versioned/typed/storage/v1alpha1" 30 fakestoragev1alpha1 "github.com/1aal/kubeblocks/pkg/client/clientset/versioned/typed/storage/v1alpha1/fake" 31 workloadsv1alpha1 "github.com/1aal/kubeblocks/pkg/client/clientset/versioned/typed/workloads/v1alpha1" 32 fakeworkloadsv1alpha1 "github.com/1aal/kubeblocks/pkg/client/clientset/versioned/typed/workloads/v1alpha1/fake" 33 "k8s.io/apimachinery/pkg/runtime" 34 "k8s.io/apimachinery/pkg/watch" 35 "k8s.io/client-go/discovery" 36 fakediscovery "k8s.io/client-go/discovery/fake" 37 "k8s.io/client-go/testing" 38 ) 39 40 // NewSimpleClientset returns a clientset that will respond with the provided objects. 41 // It's backed by a very simple object tracker that processes creates, updates and deletions as-is, 42 // without applying any validations and/or defaults. It shouldn't be considered a replacement 43 // for a real clientset and is mostly useful in simple unit tests. 44 func NewSimpleClientset(objects ...runtime.Object) *Clientset { 45 o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) 46 for _, obj := range objects { 47 if err := o.Add(obj); err != nil { 48 panic(err) 49 } 50 } 51 52 cs := &Clientset{tracker: o} 53 cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake} 54 cs.AddReactor("*", "*", testing.ObjectReaction(o)) 55 cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) { 56 gvr := action.GetResource() 57 ns := action.GetNamespace() 58 watch, err := o.Watch(gvr, ns) 59 if err != nil { 60 return false, nil, err 61 } 62 return true, watch, nil 63 }) 64 65 return cs 66 } 67 68 // Clientset implements clientset.Interface. Meant to be embedded into a 69 // struct to get a default implementation. This makes faking out just the method 70 // you want to test easier. 71 type Clientset struct { 72 testing.Fake 73 discovery *fakediscovery.FakeDiscovery 74 tracker testing.ObjectTracker 75 } 76 77 func (c *Clientset) Discovery() discovery.DiscoveryInterface { 78 return c.discovery 79 } 80 81 func (c *Clientset) Tracker() testing.ObjectTracker { 82 return c.tracker 83 } 84 85 var ( 86 _ clientset.Interface = &Clientset{} 87 _ testing.FakeClient = &Clientset{} 88 ) 89 90 // AppsV1alpha1 retrieves the AppsV1alpha1Client 91 func (c *Clientset) AppsV1alpha1() appsv1alpha1.AppsV1alpha1Interface { 92 return &fakeappsv1alpha1.FakeAppsV1alpha1{Fake: &c.Fake} 93 } 94 95 // DataprotectionV1alpha1 retrieves the DataprotectionV1alpha1Client 96 func (c *Clientset) DataprotectionV1alpha1() dataprotectionv1alpha1.DataprotectionV1alpha1Interface { 97 return &fakedataprotectionv1alpha1.FakeDataprotectionV1alpha1{Fake: &c.Fake} 98 } 99 100 // ExtensionsV1alpha1 retrieves the ExtensionsV1alpha1Client 101 func (c *Clientset) ExtensionsV1alpha1() extensionsv1alpha1.ExtensionsV1alpha1Interface { 102 return &fakeextensionsv1alpha1.FakeExtensionsV1alpha1{Fake: &c.Fake} 103 } 104 105 // StorageV1alpha1 retrieves the StorageV1alpha1Client 106 func (c *Clientset) StorageV1alpha1() storagev1alpha1.StorageV1alpha1Interface { 107 return &fakestoragev1alpha1.FakeStorageV1alpha1{Fake: &c.Fake} 108 } 109 110 // WorkloadsV1alpha1 retrieves the WorkloadsV1alpha1Client 111 func (c *Clientset) WorkloadsV1alpha1() workloadsv1alpha1.WorkloadsV1alpha1Interface { 112 return &fakeworkloadsv1alpha1.FakeWorkloadsV1alpha1{Fake: &c.Fake} 113 }