diff --git a/pkg/generated/clientset/versioned/typed/samplecontroller/v1alpha1/fake/fake_foo.go b/pkg/generated/clientset/versioned/typed/samplecontroller/v1alpha1/fake/fake_foo.go index f61c4e28..a3a767f1 100644 --- a/pkg/generated/clientset/versioned/typed/samplecontroller/v1alpha1/fake/fake_foo.go +++ b/pkg/generated/clientset/versioned/typed/samplecontroller/v1alpha1/fake/fake_foo.go @@ -19,129 +19,30 @@ limitations under the License. package fake import ( - context "context" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" + gentype "k8s.io/client-go/gentype" v1alpha1 "k8s.io/sample-controller/pkg/apis/samplecontroller/v1alpha1" + samplecontrollerv1alpha1 "k8s.io/sample-controller/pkg/generated/clientset/versioned/typed/samplecontroller/v1alpha1" ) -// FakeFoos implements FooInterface -type FakeFoos struct { +// fakeFoos implements FooInterface +type fakeFoos struct { + *gentype.FakeClientWithList[*v1alpha1.Foo, *v1alpha1.FooList] Fake *FakeSamplecontrollerV1alpha1 - ns string } -var foosResource = v1alpha1.SchemeGroupVersion.WithResource("foos") - -var foosKind = v1alpha1.SchemeGroupVersion.WithKind("Foo") - -// Get takes name of the foo, and returns the corresponding foo object, and an error if there is any. -func (c *FakeFoos) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Foo, err error) { - emptyResult := &v1alpha1.Foo{} - obj, err := c.Fake. - Invokes(testing.NewGetActionWithOptions(foosResource, c.ns, name, options), emptyResult) - - if obj == nil { - return emptyResult, err +func newFakeFoos(fake *FakeSamplecontrollerV1alpha1, namespace string) samplecontrollerv1alpha1.FooInterface { + return &fakeFoos{ + gentype.NewFakeClientWithList[*v1alpha1.Foo, *v1alpha1.FooList]( + fake.Fake, + namespace, + v1alpha1.SchemeGroupVersion.WithResource("foos"), + v1alpha1.SchemeGroupVersion.WithKind("Foo"), + func() *v1alpha1.Foo { return &v1alpha1.Foo{} }, + func() *v1alpha1.FooList { return &v1alpha1.FooList{} }, + func(dst, src *v1alpha1.FooList) { dst.ListMeta = src.ListMeta }, + func(list *v1alpha1.FooList) []*v1alpha1.Foo { return gentype.ToPointerSlice(list.Items) }, + func(list *v1alpha1.FooList, items []*v1alpha1.Foo) { list.Items = gentype.FromPointerSlice(items) }, + ), + fake, } - return obj.(*v1alpha1.Foo), err -} - -// List takes label and field selectors, and returns the list of Foos that match those selectors. -func (c *FakeFoos) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.FooList, err error) { - emptyResult := &v1alpha1.FooList{} - obj, err := c.Fake. - Invokes(testing.NewListActionWithOptions(foosResource, foosKind, c.ns, opts), emptyResult) - - if obj == nil { - return emptyResult, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.FooList{ListMeta: obj.(*v1alpha1.FooList).ListMeta} - for _, item := range obj.(*v1alpha1.FooList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested foos. -func (c *FakeFoos) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchActionWithOptions(foosResource, c.ns, opts)) - -} - -// Create takes the representation of a foo and creates it. Returns the server's representation of the foo, and an error, if there is any. -func (c *FakeFoos) Create(ctx context.Context, foo *v1alpha1.Foo, opts v1.CreateOptions) (result *v1alpha1.Foo, err error) { - emptyResult := &v1alpha1.Foo{} - obj, err := c.Fake. - Invokes(testing.NewCreateActionWithOptions(foosResource, c.ns, foo, opts), emptyResult) - - if obj == nil { - return emptyResult, err - } - return obj.(*v1alpha1.Foo), err -} - -// Update takes the representation of a foo and updates it. Returns the server's representation of the foo, and an error, if there is any. -func (c *FakeFoos) Update(ctx context.Context, foo *v1alpha1.Foo, opts v1.UpdateOptions) (result *v1alpha1.Foo, err error) { - emptyResult := &v1alpha1.Foo{} - obj, err := c.Fake. - Invokes(testing.NewUpdateActionWithOptions(foosResource, c.ns, foo, opts), emptyResult) - - if obj == nil { - return emptyResult, err - } - return obj.(*v1alpha1.Foo), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeFoos) UpdateStatus(ctx context.Context, foo *v1alpha1.Foo, opts v1.UpdateOptions) (result *v1alpha1.Foo, err error) { - emptyResult := &v1alpha1.Foo{} - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceActionWithOptions(foosResource, "status", c.ns, foo, opts), emptyResult) - - if obj == nil { - return emptyResult, err - } - return obj.(*v1alpha1.Foo), err -} - -// Delete takes name of the foo and deletes it. Returns an error if one occurs. -func (c *FakeFoos) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(foosResource, c.ns, name, opts), &v1alpha1.Foo{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeFoos) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionActionWithOptions(foosResource, c.ns, opts, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.FooList{}) - return err -} - -// Patch applies the patch and returns the patched foo. -func (c *FakeFoos) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Foo, err error) { - emptyResult := &v1alpha1.Foo{} - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceActionWithOptions(foosResource, c.ns, name, pt, data, opts, subresources...), emptyResult) - - if obj == nil { - return emptyResult, err - } - return obj.(*v1alpha1.Foo), err } diff --git a/pkg/generated/clientset/versioned/typed/samplecontroller/v1alpha1/fake/fake_samplecontroller_client.go b/pkg/generated/clientset/versioned/typed/samplecontroller/v1alpha1/fake/fake_samplecontroller_client.go index 02088eba..d5dad62f 100644 --- a/pkg/generated/clientset/versioned/typed/samplecontroller/v1alpha1/fake/fake_samplecontroller_client.go +++ b/pkg/generated/clientset/versioned/typed/samplecontroller/v1alpha1/fake/fake_samplecontroller_client.go @@ -29,7 +29,7 @@ type FakeSamplecontrollerV1alpha1 struct { } func (c *FakeSamplecontrollerV1alpha1) Foos(namespace string) v1alpha1.FooInterface { - return &FakeFoos{c, namespace} + return newFakeFoos(c, namespace) } // RESTClient returns a RESTClient that is used to communicate