github.com/giantswarm/apiextensions/v2@v2.6.2/pkg/clientset/versioned/fake/clientset_generated.go (about)

     1  /*
     2  Copyright 2020 Giant Swarm GmbH.
     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  
    28  	clientset "github.com/giantswarm/apiextensions/v2/pkg/clientset/versioned"
    29  	applicationv1alpha1 "github.com/giantswarm/apiextensions/v2/pkg/clientset/versioned/typed/application/v1alpha1"
    30  	fakeapplicationv1alpha1 "github.com/giantswarm/apiextensions/v2/pkg/clientset/versioned/typed/application/v1alpha1/fake"
    31  	backupv1alpha1 "github.com/giantswarm/apiextensions/v2/pkg/clientset/versioned/typed/backup/v1alpha1"
    32  	fakebackupv1alpha1 "github.com/giantswarm/apiextensions/v2/pkg/clientset/versioned/typed/backup/v1alpha1/fake"
    33  	corev1alpha1 "github.com/giantswarm/apiextensions/v2/pkg/clientset/versioned/typed/core/v1alpha1"
    34  	fakecorev1alpha1 "github.com/giantswarm/apiextensions/v2/pkg/clientset/versioned/typed/core/v1alpha1/fake"
    35  	examplev1alpha1 "github.com/giantswarm/apiextensions/v2/pkg/clientset/versioned/typed/example/v1alpha1"
    36  	fakeexamplev1alpha1 "github.com/giantswarm/apiextensions/v2/pkg/clientset/versioned/typed/example/v1alpha1/fake"
    37  	infrastructurev1alpha2 "github.com/giantswarm/apiextensions/v2/pkg/clientset/versioned/typed/infrastructure/v1alpha2"
    38  	fakeinfrastructurev1alpha2 "github.com/giantswarm/apiextensions/v2/pkg/clientset/versioned/typed/infrastructure/v1alpha2/fake"
    39  	providerv1alpha1 "github.com/giantswarm/apiextensions/v2/pkg/clientset/versioned/typed/provider/v1alpha1"
    40  	fakeproviderv1alpha1 "github.com/giantswarm/apiextensions/v2/pkg/clientset/versioned/typed/provider/v1alpha1/fake"
    41  	releasev1alpha1 "github.com/giantswarm/apiextensions/v2/pkg/clientset/versioned/typed/release/v1alpha1"
    42  	fakereleasev1alpha1 "github.com/giantswarm/apiextensions/v2/pkg/clientset/versioned/typed/release/v1alpha1/fake"
    43  	securityv1alpha1 "github.com/giantswarm/apiextensions/v2/pkg/clientset/versioned/typed/security/v1alpha1"
    44  	fakesecurityv1alpha1 "github.com/giantswarm/apiextensions/v2/pkg/clientset/versioned/typed/security/v1alpha1/fake"
    45  	toolingv1alpha1 "github.com/giantswarm/apiextensions/v2/pkg/clientset/versioned/typed/tooling/v1alpha1"
    46  	faketoolingv1alpha1 "github.com/giantswarm/apiextensions/v2/pkg/clientset/versioned/typed/tooling/v1alpha1/fake"
    47  )
    48  
    49  // NewSimpleClientset returns a clientset that will respond with the provided objects.
    50  // It's backed by a very simple object tracker that processes creates, updates and deletions as-is,
    51  // without applying any validations and/or defaults. It shouldn't be considered a replacement
    52  // for a real clientset and is mostly useful in simple unit tests.
    53  func NewSimpleClientset(objects ...runtime.Object) *Clientset {
    54  	o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder())
    55  	for _, obj := range objects {
    56  		if err := o.Add(obj); err != nil {
    57  			panic(err)
    58  		}
    59  	}
    60  
    61  	cs := &Clientset{tracker: o}
    62  	cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake}
    63  	cs.AddReactor("*", "*", testing.ObjectReaction(o))
    64  	cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) {
    65  		gvr := action.GetResource()
    66  		ns := action.GetNamespace()
    67  		watch, err := o.Watch(gvr, ns)
    68  		if err != nil {
    69  			return false, nil, err
    70  		}
    71  		return true, watch, nil
    72  	})
    73  
    74  	return cs
    75  }
    76  
    77  // Clientset implements clientset.Interface. Meant to be embedded into a
    78  // struct to get a default implementation. This makes faking out just the method
    79  // you want to test easier.
    80  type Clientset struct {
    81  	testing.Fake
    82  	discovery *fakediscovery.FakeDiscovery
    83  	tracker   testing.ObjectTracker
    84  }
    85  
    86  func (c *Clientset) Discovery() discovery.DiscoveryInterface {
    87  	return c.discovery
    88  }
    89  
    90  func (c *Clientset) Tracker() testing.ObjectTracker {
    91  	return c.tracker
    92  }
    93  
    94  var _ clientset.Interface = &Clientset{}
    95  
    96  // ApplicationV1alpha1 retrieves the ApplicationV1alpha1Client
    97  func (c *Clientset) ApplicationV1alpha1() applicationv1alpha1.ApplicationV1alpha1Interface {
    98  	return &fakeapplicationv1alpha1.FakeApplicationV1alpha1{Fake: &c.Fake}
    99  }
   100  
   101  // BackupV1alpha1 retrieves the BackupV1alpha1Client
   102  func (c *Clientset) BackupV1alpha1() backupv1alpha1.BackupV1alpha1Interface {
   103  	return &fakebackupv1alpha1.FakeBackupV1alpha1{Fake: &c.Fake}
   104  }
   105  
   106  // CoreV1alpha1 retrieves the CoreV1alpha1Client
   107  func (c *Clientset) CoreV1alpha1() corev1alpha1.CoreV1alpha1Interface {
   108  	return &fakecorev1alpha1.FakeCoreV1alpha1{Fake: &c.Fake}
   109  }
   110  
   111  // ExampleV1alpha1 retrieves the ExampleV1alpha1Client
   112  func (c *Clientset) ExampleV1alpha1() examplev1alpha1.ExampleV1alpha1Interface {
   113  	return &fakeexamplev1alpha1.FakeExampleV1alpha1{Fake: &c.Fake}
   114  }
   115  
   116  // InfrastructureV1alpha2 retrieves the InfrastructureV1alpha2Client
   117  func (c *Clientset) InfrastructureV1alpha2() infrastructurev1alpha2.InfrastructureV1alpha2Interface {
   118  	return &fakeinfrastructurev1alpha2.FakeInfrastructureV1alpha2{Fake: &c.Fake}
   119  }
   120  
   121  // ProviderV1alpha1 retrieves the ProviderV1alpha1Client
   122  func (c *Clientset) ProviderV1alpha1() providerv1alpha1.ProviderV1alpha1Interface {
   123  	return &fakeproviderv1alpha1.FakeProviderV1alpha1{Fake: &c.Fake}
   124  }
   125  
   126  // ReleaseV1alpha1 retrieves the ReleaseV1alpha1Client
   127  func (c *Clientset) ReleaseV1alpha1() releasev1alpha1.ReleaseV1alpha1Interface {
   128  	return &fakereleasev1alpha1.FakeReleaseV1alpha1{Fake: &c.Fake}
   129  }
   130  
   131  // SecurityV1alpha1 retrieves the SecurityV1alpha1Client
   132  func (c *Clientset) SecurityV1alpha1() securityv1alpha1.SecurityV1alpha1Interface {
   133  	return &fakesecurityv1alpha1.FakeSecurityV1alpha1{Fake: &c.Fake}
   134  }
   135  
   136  // ToolingV1alpha1 retrieves the ToolingV1alpha1Client
   137  func (c *Clientset) ToolingV1alpha1() toolingv1alpha1.ToolingV1alpha1Interface {
   138  	return &faketoolingv1alpha1.FakeToolingV1alpha1{Fake: &c.Fake}
   139  }