github.com/jingruilea/kubeedge@v1.2.0-beta.0.0.20200410162146-4bb8902b3879/cloud/pkg/client/clientset/versioned/fake/clientset_generated.go (about) 1 /* 2 Copyright 2020 The KubeEdge 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 // Code generated by client-gen. DO NOT EDIT. 17 18 package fake 19 20 import ( 21 clientset "github.com/kubeedge/kubeedge/cloud/pkg/client/clientset/versioned" 22 devicesv1alpha1 "github.com/kubeedge/kubeedge/cloud/pkg/client/clientset/versioned/typed/devices/v1alpha1" 23 fakedevicesv1alpha1 "github.com/kubeedge/kubeedge/cloud/pkg/client/clientset/versioned/typed/devices/v1alpha1/fake" 24 reliablesyncsv1alpha1 "github.com/kubeedge/kubeedge/cloud/pkg/client/clientset/versioned/typed/reliablesyncs/v1alpha1" 25 fakereliablesyncsv1alpha1 "github.com/kubeedge/kubeedge/cloud/pkg/client/clientset/versioned/typed/reliablesyncs/v1alpha1/fake" 26 "k8s.io/apimachinery/pkg/runtime" 27 "k8s.io/apimachinery/pkg/watch" 28 "k8s.io/client-go/discovery" 29 fakediscovery "k8s.io/client-go/discovery/fake" 30 "k8s.io/client-go/testing" 31 ) 32 33 // NewSimpleClientset returns a clientset that will respond with the provided objects. 34 // It's backed by a very simple object tracker that processes creates, updates and deletions as-is, 35 // without applying any validations and/or defaults. It shouldn't be considered a replacement 36 // for a real clientset and is mostly useful in simple unit tests. 37 func NewSimpleClientset(objects ...runtime.Object) *Clientset { 38 o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) 39 for _, obj := range objects { 40 if err := o.Add(obj); err != nil { 41 panic(err) 42 } 43 } 44 45 cs := &Clientset{tracker: o} 46 cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake} 47 cs.AddReactor("*", "*", testing.ObjectReaction(o)) 48 cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) { 49 gvr := action.GetResource() 50 ns := action.GetNamespace() 51 watch, err := o.Watch(gvr, ns) 52 if err != nil { 53 return false, nil, err 54 } 55 return true, watch, nil 56 }) 57 58 return cs 59 } 60 61 // Clientset implements clientset.Interface. Meant to be embedded into a 62 // struct to get a default implementation. This makes faking out just the method 63 // you want to test easier. 64 type Clientset struct { 65 testing.Fake 66 discovery *fakediscovery.FakeDiscovery 67 tracker testing.ObjectTracker 68 } 69 70 func (c *Clientset) Discovery() discovery.DiscoveryInterface { 71 return c.discovery 72 } 73 74 func (c *Clientset) Tracker() testing.ObjectTracker { 75 return c.tracker 76 } 77 78 var _ clientset.Interface = &Clientset{} 79 80 // DevicesV1alpha1 retrieves the DevicesV1alpha1Client 81 func (c *Clientset) DevicesV1alpha1() devicesv1alpha1.DevicesV1alpha1Interface { 82 return &fakedevicesv1alpha1.FakeDevicesV1alpha1{Fake: &c.Fake} 83 } 84 85 // ReliablesyncsV1alpha1 retrieves the ReliablesyncsV1alpha1Client 86 func (c *Clientset) ReliablesyncsV1alpha1() reliablesyncsv1alpha1.ReliablesyncsV1alpha1Interface { 87 return &fakereliablesyncsv1alpha1.FakeReliablesyncsV1alpha1{Fake: &c.Fake} 88 }