diff --git a/pkg/generated/clientset/versioned/fake/clientset_generated.go b/pkg/generated/clientset/versioned/fake/clientset_generated.go index 301a48790..26d5f6500 100644 --- a/pkg/generated/clientset/versioned/fake/clientset_generated.go +++ b/pkg/generated/clientset/versioned/fake/clientset_generated.go @@ -17,8 +17,12 @@ import ( // NewSimpleClientset returns a clientset that will respond with the provided objects. // It's backed by a very simple object tracker that processes creates, updates and deletions as-is, -// without applying any validations and/or defaults. It shouldn't be considered a replacement +// without applying any field management, validations and/or defaults. It shouldn't be considered a replacement // for a real clientset and is mostly useful in simple unit tests. +// +// DEPRECATED: NewClientset replaces this with support for field management, which significantly improves +// server side apply testing. NewClientset is only available when apply configurations are generated (e.g. +// via --with-applyconfig). func NewSimpleClientset(objects ...runtime.Object) *Clientset { o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) for _, obj := range objects { diff --git a/pkg/generated/clientset/versioned/typed/cluster/v1alpha2/clustersyncresources.go b/pkg/generated/clientset/versioned/typed/cluster/v1alpha2/clustersyncresources.go index a8fa13fd2..a33c6a4f4 100644 --- a/pkg/generated/clientset/versioned/typed/cluster/v1alpha2/clustersyncresources.go +++ b/pkg/generated/clientset/versioned/typed/cluster/v1alpha2/clustersyncresources.go @@ -4,14 +4,13 @@ package v1alpha2 import ( "context" - "time" v1alpha2 "github.com/clusterpedia-io/api/cluster/v1alpha2" scheme "github.com/clusterpedia-io/clusterpedia/pkg/generated/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // ClusterSyncResourcesGetter has a method to return a ClusterSyncResourcesInterface. @@ -35,118 +34,18 @@ type ClusterSyncResourcesInterface interface { // clusterSyncResources implements ClusterSyncResourcesInterface type clusterSyncResources struct { - client rest.Interface + *gentype.ClientWithList[*v1alpha2.ClusterSyncResources, *v1alpha2.ClusterSyncResourcesList] } // newClusterSyncResources returns a ClusterSyncResources func newClusterSyncResources(c *ClusterV1alpha2Client) *clusterSyncResources { return &clusterSyncResources{ - client: c.RESTClient(), + gentype.NewClientWithList[*v1alpha2.ClusterSyncResources, *v1alpha2.ClusterSyncResourcesList]( + "clustersyncresources", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *v1alpha2.ClusterSyncResources { return &v1alpha2.ClusterSyncResources{} }, + func() *v1alpha2.ClusterSyncResourcesList { return &v1alpha2.ClusterSyncResourcesList{} }), } } - -// Get takes name of the clusterSyncResources, and returns the corresponding clusterSyncResources object, and an error if there is any. -func (c *clusterSyncResources) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.ClusterSyncResources, err error) { - result = &v1alpha2.ClusterSyncResources{} - err = c.client.Get(). - Resource("clustersyncresources"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of ClusterSyncResources that match those selectors. -func (c *clusterSyncResources) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.ClusterSyncResourcesList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha2.ClusterSyncResourcesList{} - err = c.client.Get(). - Resource("clustersyncresources"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested clusterSyncResources. -func (c *clusterSyncResources) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("clustersyncresources"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a clusterSyncResources and creates it. Returns the server's representation of the clusterSyncResources, and an error, if there is any. -func (c *clusterSyncResources) Create(ctx context.Context, clusterSyncResources *v1alpha2.ClusterSyncResources, opts v1.CreateOptions) (result *v1alpha2.ClusterSyncResources, err error) { - result = &v1alpha2.ClusterSyncResources{} - err = c.client.Post(). - Resource("clustersyncresources"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(clusterSyncResources). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a clusterSyncResources and updates it. Returns the server's representation of the clusterSyncResources, and an error, if there is any. -func (c *clusterSyncResources) Update(ctx context.Context, clusterSyncResources *v1alpha2.ClusterSyncResources, opts v1.UpdateOptions) (result *v1alpha2.ClusterSyncResources, err error) { - result = &v1alpha2.ClusterSyncResources{} - err = c.client.Put(). - Resource("clustersyncresources"). - Name(clusterSyncResources.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(clusterSyncResources). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the clusterSyncResources and deletes it. Returns an error if one occurs. -func (c *clusterSyncResources) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("clustersyncresources"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *clusterSyncResources) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("clustersyncresources"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched clusterSyncResources. -func (c *clusterSyncResources) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.ClusterSyncResources, err error) { - result = &v1alpha2.ClusterSyncResources{} - err = c.client.Patch(pt). - Resource("clustersyncresources"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/generated/clientset/versioned/typed/cluster/v1alpha2/fake/fake_clustersyncresources.go b/pkg/generated/clientset/versioned/typed/cluster/v1alpha2/fake/fake_clustersyncresources.go index 4b11a666f..9e8baac15 100644 --- a/pkg/generated/clientset/versioned/typed/cluster/v1alpha2/fake/fake_clustersyncresources.go +++ b/pkg/generated/clientset/versioned/typed/cluster/v1alpha2/fake/fake_clustersyncresources.go @@ -24,20 +24,22 @@ var clustersyncresourcesKind = v1alpha2.SchemeGroupVersion.WithKind("ClusterSync // Get takes name of the clusterSyncResources, and returns the corresponding clusterSyncResources object, and an error if there is any. func (c *FakeClusterSyncResources) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.ClusterSyncResources, err error) { + emptyResult := &v1alpha2.ClusterSyncResources{} obj, err := c.Fake. - Invokes(testing.NewRootGetAction(clustersyncresourcesResource, name), &v1alpha2.ClusterSyncResources{}) + Invokes(testing.NewRootGetActionWithOptions(clustersyncresourcesResource, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.ClusterSyncResources), err } // List takes label and field selectors, and returns the list of ClusterSyncResources that match those selectors. func (c *FakeClusterSyncResources) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.ClusterSyncResourcesList, err error) { + emptyResult := &v1alpha2.ClusterSyncResourcesList{} obj, err := c.Fake. - Invokes(testing.NewRootListAction(clustersyncresourcesResource, clustersyncresourcesKind, opts), &v1alpha2.ClusterSyncResourcesList{}) + Invokes(testing.NewRootListActionWithOptions(clustersyncresourcesResource, clustersyncresourcesKind, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -56,25 +58,27 @@ func (c *FakeClusterSyncResources) List(ctx context.Context, opts v1.ListOptions // Watch returns a watch.Interface that watches the requested clusterSyncResources. func (c *FakeClusterSyncResources) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewRootWatchAction(clustersyncresourcesResource, opts)) + InvokesWatch(testing.NewRootWatchActionWithOptions(clustersyncresourcesResource, opts)) } // Create takes the representation of a clusterSyncResources and creates it. Returns the server's representation of the clusterSyncResources, and an error, if there is any. func (c *FakeClusterSyncResources) Create(ctx context.Context, clusterSyncResources *v1alpha2.ClusterSyncResources, opts v1.CreateOptions) (result *v1alpha2.ClusterSyncResources, err error) { + emptyResult := &v1alpha2.ClusterSyncResources{} obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(clustersyncresourcesResource, clusterSyncResources), &v1alpha2.ClusterSyncResources{}) + Invokes(testing.NewRootCreateActionWithOptions(clustersyncresourcesResource, clusterSyncResources, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.ClusterSyncResources), err } // Update takes the representation of a clusterSyncResources and updates it. Returns the server's representation of the clusterSyncResources, and an error, if there is any. func (c *FakeClusterSyncResources) Update(ctx context.Context, clusterSyncResources *v1alpha2.ClusterSyncResources, opts v1.UpdateOptions) (result *v1alpha2.ClusterSyncResources, err error) { + emptyResult := &v1alpha2.ClusterSyncResources{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(clustersyncresourcesResource, clusterSyncResources), &v1alpha2.ClusterSyncResources{}) + Invokes(testing.NewRootUpdateActionWithOptions(clustersyncresourcesResource, clusterSyncResources, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.ClusterSyncResources), err } @@ -88,7 +92,7 @@ func (c *FakeClusterSyncResources) Delete(ctx context.Context, name string, opts // DeleteCollection deletes a collection of objects. func (c *FakeClusterSyncResources) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(clustersyncresourcesResource, listOpts) + action := testing.NewRootDeleteCollectionActionWithOptions(clustersyncresourcesResource, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha2.ClusterSyncResourcesList{}) return err @@ -96,10 +100,11 @@ func (c *FakeClusterSyncResources) DeleteCollection(ctx context.Context, opts v1 // Patch applies the patch and returns the patched clusterSyncResources. func (c *FakeClusterSyncResources) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.ClusterSyncResources, err error) { + emptyResult := &v1alpha2.ClusterSyncResources{} obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(clustersyncresourcesResource, name, pt, data, subresources...), &v1alpha2.ClusterSyncResources{}) + Invokes(testing.NewRootPatchSubresourceActionWithOptions(clustersyncresourcesResource, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.ClusterSyncResources), err } diff --git a/pkg/generated/clientset/versioned/typed/cluster/v1alpha2/fake/fake_pediacluster.go b/pkg/generated/clientset/versioned/typed/cluster/v1alpha2/fake/fake_pediacluster.go index 2806d88c3..11a4fd9c5 100644 --- a/pkg/generated/clientset/versioned/typed/cluster/v1alpha2/fake/fake_pediacluster.go +++ b/pkg/generated/clientset/versioned/typed/cluster/v1alpha2/fake/fake_pediacluster.go @@ -24,20 +24,22 @@ var pediaclustersKind = v1alpha2.SchemeGroupVersion.WithKind("PediaCluster") // Get takes name of the pediaCluster, and returns the corresponding pediaCluster object, and an error if there is any. func (c *FakePediaClusters) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.PediaCluster, err error) { + emptyResult := &v1alpha2.PediaCluster{} obj, err := c.Fake. - Invokes(testing.NewRootGetAction(pediaclustersResource, name), &v1alpha2.PediaCluster{}) + Invokes(testing.NewRootGetActionWithOptions(pediaclustersResource, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.PediaCluster), err } // List takes label and field selectors, and returns the list of PediaClusters that match those selectors. func (c *FakePediaClusters) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.PediaClusterList, err error) { + emptyResult := &v1alpha2.PediaClusterList{} obj, err := c.Fake. - Invokes(testing.NewRootListAction(pediaclustersResource, pediaclustersKind, opts), &v1alpha2.PediaClusterList{}) + Invokes(testing.NewRootListActionWithOptions(pediaclustersResource, pediaclustersKind, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -56,36 +58,39 @@ func (c *FakePediaClusters) List(ctx context.Context, opts v1.ListOptions) (resu // Watch returns a watch.Interface that watches the requested pediaClusters. func (c *FakePediaClusters) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewRootWatchAction(pediaclustersResource, opts)) + InvokesWatch(testing.NewRootWatchActionWithOptions(pediaclustersResource, opts)) } // Create takes the representation of a pediaCluster and creates it. Returns the server's representation of the pediaCluster, and an error, if there is any. func (c *FakePediaClusters) Create(ctx context.Context, pediaCluster *v1alpha2.PediaCluster, opts v1.CreateOptions) (result *v1alpha2.PediaCluster, err error) { + emptyResult := &v1alpha2.PediaCluster{} obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(pediaclustersResource, pediaCluster), &v1alpha2.PediaCluster{}) + Invokes(testing.NewRootCreateActionWithOptions(pediaclustersResource, pediaCluster, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.PediaCluster), err } // Update takes the representation of a pediaCluster and updates it. Returns the server's representation of the pediaCluster, and an error, if there is any. func (c *FakePediaClusters) Update(ctx context.Context, pediaCluster *v1alpha2.PediaCluster, opts v1.UpdateOptions) (result *v1alpha2.PediaCluster, err error) { + emptyResult := &v1alpha2.PediaCluster{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(pediaclustersResource, pediaCluster), &v1alpha2.PediaCluster{}) + Invokes(testing.NewRootUpdateActionWithOptions(pediaclustersResource, pediaCluster, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.PediaCluster), 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 *FakePediaClusters) UpdateStatus(ctx context.Context, pediaCluster *v1alpha2.PediaCluster, opts v1.UpdateOptions) (*v1alpha2.PediaCluster, error) { +func (c *FakePediaClusters) UpdateStatus(ctx context.Context, pediaCluster *v1alpha2.PediaCluster, opts v1.UpdateOptions) (result *v1alpha2.PediaCluster, err error) { + emptyResult := &v1alpha2.PediaCluster{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(pediaclustersResource, "status", pediaCluster), &v1alpha2.PediaCluster{}) + Invokes(testing.NewRootUpdateSubresourceActionWithOptions(pediaclustersResource, "status", pediaCluster, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.PediaCluster), err } @@ -99,7 +104,7 @@ func (c *FakePediaClusters) Delete(ctx context.Context, name string, opts v1.Del // DeleteCollection deletes a collection of objects. func (c *FakePediaClusters) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(pediaclustersResource, listOpts) + action := testing.NewRootDeleteCollectionActionWithOptions(pediaclustersResource, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha2.PediaClusterList{}) return err @@ -107,10 +112,11 @@ func (c *FakePediaClusters) DeleteCollection(ctx context.Context, opts v1.Delete // Patch applies the patch and returns the patched pediaCluster. func (c *FakePediaClusters) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.PediaCluster, err error) { + emptyResult := &v1alpha2.PediaCluster{} obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(pediaclustersResource, name, pt, data, subresources...), &v1alpha2.PediaCluster{}) + Invokes(testing.NewRootPatchSubresourceActionWithOptions(pediaclustersResource, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.PediaCluster), err } diff --git a/pkg/generated/clientset/versioned/typed/cluster/v1alpha2/pediacluster.go b/pkg/generated/clientset/versioned/typed/cluster/v1alpha2/pediacluster.go index 0f85193de..5e571c6b5 100644 --- a/pkg/generated/clientset/versioned/typed/cluster/v1alpha2/pediacluster.go +++ b/pkg/generated/clientset/versioned/typed/cluster/v1alpha2/pediacluster.go @@ -4,14 +4,13 @@ package v1alpha2 import ( "context" - "time" v1alpha2 "github.com/clusterpedia-io/api/cluster/v1alpha2" scheme "github.com/clusterpedia-io/clusterpedia/pkg/generated/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // PediaClustersGetter has a method to return a PediaClusterInterface. @@ -24,6 +23,7 @@ type PediaClustersGetter interface { type PediaClusterInterface interface { Create(ctx context.Context, pediaCluster *v1alpha2.PediaCluster, opts v1.CreateOptions) (*v1alpha2.PediaCluster, error) Update(ctx context.Context, pediaCluster *v1alpha2.PediaCluster, opts v1.UpdateOptions) (*v1alpha2.PediaCluster, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, pediaCluster *v1alpha2.PediaCluster, opts v1.UpdateOptions) (*v1alpha2.PediaCluster, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -36,133 +36,18 @@ type PediaClusterInterface interface { // pediaClusters implements PediaClusterInterface type pediaClusters struct { - client rest.Interface + *gentype.ClientWithList[*v1alpha2.PediaCluster, *v1alpha2.PediaClusterList] } // newPediaClusters returns a PediaClusters func newPediaClusters(c *ClusterV1alpha2Client) *pediaClusters { return &pediaClusters{ - client: c.RESTClient(), + gentype.NewClientWithList[*v1alpha2.PediaCluster, *v1alpha2.PediaClusterList]( + "pediaclusters", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *v1alpha2.PediaCluster { return &v1alpha2.PediaCluster{} }, + func() *v1alpha2.PediaClusterList { return &v1alpha2.PediaClusterList{} }), } } - -// Get takes name of the pediaCluster, and returns the corresponding pediaCluster object, and an error if there is any. -func (c *pediaClusters) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.PediaCluster, err error) { - result = &v1alpha2.PediaCluster{} - err = c.client.Get(). - Resource("pediaclusters"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of PediaClusters that match those selectors. -func (c *pediaClusters) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.PediaClusterList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha2.PediaClusterList{} - err = c.client.Get(). - Resource("pediaclusters"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested pediaClusters. -func (c *pediaClusters) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("pediaclusters"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a pediaCluster and creates it. Returns the server's representation of the pediaCluster, and an error, if there is any. -func (c *pediaClusters) Create(ctx context.Context, pediaCluster *v1alpha2.PediaCluster, opts v1.CreateOptions) (result *v1alpha2.PediaCluster, err error) { - result = &v1alpha2.PediaCluster{} - err = c.client.Post(). - Resource("pediaclusters"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(pediaCluster). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a pediaCluster and updates it. Returns the server's representation of the pediaCluster, and an error, if there is any. -func (c *pediaClusters) Update(ctx context.Context, pediaCluster *v1alpha2.PediaCluster, opts v1.UpdateOptions) (result *v1alpha2.PediaCluster, err error) { - result = &v1alpha2.PediaCluster{} - err = c.client.Put(). - Resource("pediaclusters"). - Name(pediaCluster.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(pediaCluster). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *pediaClusters) UpdateStatus(ctx context.Context, pediaCluster *v1alpha2.PediaCluster, opts v1.UpdateOptions) (result *v1alpha2.PediaCluster, err error) { - result = &v1alpha2.PediaCluster{} - err = c.client.Put(). - Resource("pediaclusters"). - Name(pediaCluster.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(pediaCluster). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the pediaCluster and deletes it. Returns an error if one occurs. -func (c *pediaClusters) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("pediaclusters"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *pediaClusters) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("pediaclusters"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched pediaCluster. -func (c *pediaClusters) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.PediaCluster, err error) { - result = &v1alpha2.PediaCluster{} - err = c.client.Patch(pt). - Resource("pediaclusters"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/generated/clientset/versioned/typed/policy/v1alpha1/clusterimportpolicy.go b/pkg/generated/clientset/versioned/typed/policy/v1alpha1/clusterimportpolicy.go index a4d7f5d39..b9fc86656 100644 --- a/pkg/generated/clientset/versioned/typed/policy/v1alpha1/clusterimportpolicy.go +++ b/pkg/generated/clientset/versioned/typed/policy/v1alpha1/clusterimportpolicy.go @@ -4,14 +4,13 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "github.com/clusterpedia-io/api/policy/v1alpha1" scheme "github.com/clusterpedia-io/clusterpedia/pkg/generated/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // ClusterImportPoliciesGetter has a method to return a ClusterImportPolicyInterface. @@ -24,6 +23,7 @@ type ClusterImportPoliciesGetter interface { type ClusterImportPolicyInterface interface { Create(ctx context.Context, clusterImportPolicy *v1alpha1.ClusterImportPolicy, opts v1.CreateOptions) (*v1alpha1.ClusterImportPolicy, error) Update(ctx context.Context, clusterImportPolicy *v1alpha1.ClusterImportPolicy, opts v1.UpdateOptions) (*v1alpha1.ClusterImportPolicy, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, clusterImportPolicy *v1alpha1.ClusterImportPolicy, opts v1.UpdateOptions) (*v1alpha1.ClusterImportPolicy, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -36,133 +36,18 @@ type ClusterImportPolicyInterface interface { // clusterImportPolicies implements ClusterImportPolicyInterface type clusterImportPolicies struct { - client rest.Interface + *gentype.ClientWithList[*v1alpha1.ClusterImportPolicy, *v1alpha1.ClusterImportPolicyList] } // newClusterImportPolicies returns a ClusterImportPolicies func newClusterImportPolicies(c *PolicyV1alpha1Client) *clusterImportPolicies { return &clusterImportPolicies{ - client: c.RESTClient(), + gentype.NewClientWithList[*v1alpha1.ClusterImportPolicy, *v1alpha1.ClusterImportPolicyList]( + "clusterimportpolicies", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *v1alpha1.ClusterImportPolicy { return &v1alpha1.ClusterImportPolicy{} }, + func() *v1alpha1.ClusterImportPolicyList { return &v1alpha1.ClusterImportPolicyList{} }), } } - -// Get takes name of the clusterImportPolicy, and returns the corresponding clusterImportPolicy object, and an error if there is any. -func (c *clusterImportPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ClusterImportPolicy, err error) { - result = &v1alpha1.ClusterImportPolicy{} - err = c.client.Get(). - Resource("clusterimportpolicies"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of ClusterImportPolicies that match those selectors. -func (c *clusterImportPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ClusterImportPolicyList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.ClusterImportPolicyList{} - err = c.client.Get(). - Resource("clusterimportpolicies"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested clusterImportPolicies. -func (c *clusterImportPolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("clusterimportpolicies"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a clusterImportPolicy and creates it. Returns the server's representation of the clusterImportPolicy, and an error, if there is any. -func (c *clusterImportPolicies) Create(ctx context.Context, clusterImportPolicy *v1alpha1.ClusterImportPolicy, opts v1.CreateOptions) (result *v1alpha1.ClusterImportPolicy, err error) { - result = &v1alpha1.ClusterImportPolicy{} - err = c.client.Post(). - Resource("clusterimportpolicies"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(clusterImportPolicy). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a clusterImportPolicy and updates it. Returns the server's representation of the clusterImportPolicy, and an error, if there is any. -func (c *clusterImportPolicies) Update(ctx context.Context, clusterImportPolicy *v1alpha1.ClusterImportPolicy, opts v1.UpdateOptions) (result *v1alpha1.ClusterImportPolicy, err error) { - result = &v1alpha1.ClusterImportPolicy{} - err = c.client.Put(). - Resource("clusterimportpolicies"). - Name(clusterImportPolicy.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(clusterImportPolicy). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *clusterImportPolicies) UpdateStatus(ctx context.Context, clusterImportPolicy *v1alpha1.ClusterImportPolicy, opts v1.UpdateOptions) (result *v1alpha1.ClusterImportPolicy, err error) { - result = &v1alpha1.ClusterImportPolicy{} - err = c.client.Put(). - Resource("clusterimportpolicies"). - Name(clusterImportPolicy.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(clusterImportPolicy). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the clusterImportPolicy and deletes it. Returns an error if one occurs. -func (c *clusterImportPolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("clusterimportpolicies"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *clusterImportPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("clusterimportpolicies"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched clusterImportPolicy. -func (c *clusterImportPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterImportPolicy, err error) { - result = &v1alpha1.ClusterImportPolicy{} - err = c.client.Patch(pt). - Resource("clusterimportpolicies"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/generated/clientset/versioned/typed/policy/v1alpha1/fake/fake_clusterimportpolicy.go b/pkg/generated/clientset/versioned/typed/policy/v1alpha1/fake/fake_clusterimportpolicy.go index b1bba85ba..865e6ffd1 100644 --- a/pkg/generated/clientset/versioned/typed/policy/v1alpha1/fake/fake_clusterimportpolicy.go +++ b/pkg/generated/clientset/versioned/typed/policy/v1alpha1/fake/fake_clusterimportpolicy.go @@ -24,20 +24,22 @@ var clusterimportpoliciesKind = v1alpha1.SchemeGroupVersion.WithKind("ClusterImp // Get takes name of the clusterImportPolicy, and returns the corresponding clusterImportPolicy object, and an error if there is any. func (c *FakeClusterImportPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ClusterImportPolicy, err error) { + emptyResult := &v1alpha1.ClusterImportPolicy{} obj, err := c.Fake. - Invokes(testing.NewRootGetAction(clusterimportpoliciesResource, name), &v1alpha1.ClusterImportPolicy{}) + Invokes(testing.NewRootGetActionWithOptions(clusterimportpoliciesResource, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ClusterImportPolicy), err } // List takes label and field selectors, and returns the list of ClusterImportPolicies that match those selectors. func (c *FakeClusterImportPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ClusterImportPolicyList, err error) { + emptyResult := &v1alpha1.ClusterImportPolicyList{} obj, err := c.Fake. - Invokes(testing.NewRootListAction(clusterimportpoliciesResource, clusterimportpoliciesKind, opts), &v1alpha1.ClusterImportPolicyList{}) + Invokes(testing.NewRootListActionWithOptions(clusterimportpoliciesResource, clusterimportpoliciesKind, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -56,36 +58,39 @@ func (c *FakeClusterImportPolicies) List(ctx context.Context, opts v1.ListOption // Watch returns a watch.Interface that watches the requested clusterImportPolicies. func (c *FakeClusterImportPolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewRootWatchAction(clusterimportpoliciesResource, opts)) + InvokesWatch(testing.NewRootWatchActionWithOptions(clusterimportpoliciesResource, opts)) } // Create takes the representation of a clusterImportPolicy and creates it. Returns the server's representation of the clusterImportPolicy, and an error, if there is any. func (c *FakeClusterImportPolicies) Create(ctx context.Context, clusterImportPolicy *v1alpha1.ClusterImportPolicy, opts v1.CreateOptions) (result *v1alpha1.ClusterImportPolicy, err error) { + emptyResult := &v1alpha1.ClusterImportPolicy{} obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(clusterimportpoliciesResource, clusterImportPolicy), &v1alpha1.ClusterImportPolicy{}) + Invokes(testing.NewRootCreateActionWithOptions(clusterimportpoliciesResource, clusterImportPolicy, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ClusterImportPolicy), err } // Update takes the representation of a clusterImportPolicy and updates it. Returns the server's representation of the clusterImportPolicy, and an error, if there is any. func (c *FakeClusterImportPolicies) Update(ctx context.Context, clusterImportPolicy *v1alpha1.ClusterImportPolicy, opts v1.UpdateOptions) (result *v1alpha1.ClusterImportPolicy, err error) { + emptyResult := &v1alpha1.ClusterImportPolicy{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(clusterimportpoliciesResource, clusterImportPolicy), &v1alpha1.ClusterImportPolicy{}) + Invokes(testing.NewRootUpdateActionWithOptions(clusterimportpoliciesResource, clusterImportPolicy, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ClusterImportPolicy), 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 *FakeClusterImportPolicies) UpdateStatus(ctx context.Context, clusterImportPolicy *v1alpha1.ClusterImportPolicy, opts v1.UpdateOptions) (*v1alpha1.ClusterImportPolicy, error) { +func (c *FakeClusterImportPolicies) UpdateStatus(ctx context.Context, clusterImportPolicy *v1alpha1.ClusterImportPolicy, opts v1.UpdateOptions) (result *v1alpha1.ClusterImportPolicy, err error) { + emptyResult := &v1alpha1.ClusterImportPolicy{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(clusterimportpoliciesResource, "status", clusterImportPolicy), &v1alpha1.ClusterImportPolicy{}) + Invokes(testing.NewRootUpdateSubresourceActionWithOptions(clusterimportpoliciesResource, "status", clusterImportPolicy, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ClusterImportPolicy), err } @@ -99,7 +104,7 @@ func (c *FakeClusterImportPolicies) Delete(ctx context.Context, name string, opt // DeleteCollection deletes a collection of objects. func (c *FakeClusterImportPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(clusterimportpoliciesResource, listOpts) + action := testing.NewRootDeleteCollectionActionWithOptions(clusterimportpoliciesResource, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.ClusterImportPolicyList{}) return err @@ -107,10 +112,11 @@ func (c *FakeClusterImportPolicies) DeleteCollection(ctx context.Context, opts v // Patch applies the patch and returns the patched clusterImportPolicy. func (c *FakeClusterImportPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterImportPolicy, err error) { + emptyResult := &v1alpha1.ClusterImportPolicy{} obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(clusterimportpoliciesResource, name, pt, data, subresources...), &v1alpha1.ClusterImportPolicy{}) + Invokes(testing.NewRootPatchSubresourceActionWithOptions(clusterimportpoliciesResource, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ClusterImportPolicy), err } diff --git a/pkg/generated/clientset/versioned/typed/policy/v1alpha1/fake/fake_pediaclusterlifecycle.go b/pkg/generated/clientset/versioned/typed/policy/v1alpha1/fake/fake_pediaclusterlifecycle.go index be824946f..5a16cb2ac 100644 --- a/pkg/generated/clientset/versioned/typed/policy/v1alpha1/fake/fake_pediaclusterlifecycle.go +++ b/pkg/generated/clientset/versioned/typed/policy/v1alpha1/fake/fake_pediaclusterlifecycle.go @@ -24,20 +24,22 @@ var pediaclusterlifecyclesKind = v1alpha1.SchemeGroupVersion.WithKind("PediaClus // Get takes name of the pediaClusterLifecycle, and returns the corresponding pediaClusterLifecycle object, and an error if there is any. func (c *FakePediaClusterLifecycles) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.PediaClusterLifecycle, err error) { + emptyResult := &v1alpha1.PediaClusterLifecycle{} obj, err := c.Fake. - Invokes(testing.NewRootGetAction(pediaclusterlifecyclesResource, name), &v1alpha1.PediaClusterLifecycle{}) + Invokes(testing.NewRootGetActionWithOptions(pediaclusterlifecyclesResource, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.PediaClusterLifecycle), err } // List takes label and field selectors, and returns the list of PediaClusterLifecycles that match those selectors. func (c *FakePediaClusterLifecycles) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.PediaClusterLifecycleList, err error) { + emptyResult := &v1alpha1.PediaClusterLifecycleList{} obj, err := c.Fake. - Invokes(testing.NewRootListAction(pediaclusterlifecyclesResource, pediaclusterlifecyclesKind, opts), &v1alpha1.PediaClusterLifecycleList{}) + Invokes(testing.NewRootListActionWithOptions(pediaclusterlifecyclesResource, pediaclusterlifecyclesKind, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -56,36 +58,39 @@ func (c *FakePediaClusterLifecycles) List(ctx context.Context, opts v1.ListOptio // Watch returns a watch.Interface that watches the requested pediaClusterLifecycles. func (c *FakePediaClusterLifecycles) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewRootWatchAction(pediaclusterlifecyclesResource, opts)) + InvokesWatch(testing.NewRootWatchActionWithOptions(pediaclusterlifecyclesResource, opts)) } // Create takes the representation of a pediaClusterLifecycle and creates it. Returns the server's representation of the pediaClusterLifecycle, and an error, if there is any. func (c *FakePediaClusterLifecycles) Create(ctx context.Context, pediaClusterLifecycle *v1alpha1.PediaClusterLifecycle, opts v1.CreateOptions) (result *v1alpha1.PediaClusterLifecycle, err error) { + emptyResult := &v1alpha1.PediaClusterLifecycle{} obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(pediaclusterlifecyclesResource, pediaClusterLifecycle), &v1alpha1.PediaClusterLifecycle{}) + Invokes(testing.NewRootCreateActionWithOptions(pediaclusterlifecyclesResource, pediaClusterLifecycle, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.PediaClusterLifecycle), err } // Update takes the representation of a pediaClusterLifecycle and updates it. Returns the server's representation of the pediaClusterLifecycle, and an error, if there is any. func (c *FakePediaClusterLifecycles) Update(ctx context.Context, pediaClusterLifecycle *v1alpha1.PediaClusterLifecycle, opts v1.UpdateOptions) (result *v1alpha1.PediaClusterLifecycle, err error) { + emptyResult := &v1alpha1.PediaClusterLifecycle{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(pediaclusterlifecyclesResource, pediaClusterLifecycle), &v1alpha1.PediaClusterLifecycle{}) + Invokes(testing.NewRootUpdateActionWithOptions(pediaclusterlifecyclesResource, pediaClusterLifecycle, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.PediaClusterLifecycle), 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 *FakePediaClusterLifecycles) UpdateStatus(ctx context.Context, pediaClusterLifecycle *v1alpha1.PediaClusterLifecycle, opts v1.UpdateOptions) (*v1alpha1.PediaClusterLifecycle, error) { +func (c *FakePediaClusterLifecycles) UpdateStatus(ctx context.Context, pediaClusterLifecycle *v1alpha1.PediaClusterLifecycle, opts v1.UpdateOptions) (result *v1alpha1.PediaClusterLifecycle, err error) { + emptyResult := &v1alpha1.PediaClusterLifecycle{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(pediaclusterlifecyclesResource, "status", pediaClusterLifecycle), &v1alpha1.PediaClusterLifecycle{}) + Invokes(testing.NewRootUpdateSubresourceActionWithOptions(pediaclusterlifecyclesResource, "status", pediaClusterLifecycle, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.PediaClusterLifecycle), err } @@ -99,7 +104,7 @@ func (c *FakePediaClusterLifecycles) Delete(ctx context.Context, name string, op // DeleteCollection deletes a collection of objects. func (c *FakePediaClusterLifecycles) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(pediaclusterlifecyclesResource, listOpts) + action := testing.NewRootDeleteCollectionActionWithOptions(pediaclusterlifecyclesResource, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.PediaClusterLifecycleList{}) return err @@ -107,10 +112,11 @@ func (c *FakePediaClusterLifecycles) DeleteCollection(ctx context.Context, opts // Patch applies the patch and returns the patched pediaClusterLifecycle. func (c *FakePediaClusterLifecycles) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.PediaClusterLifecycle, err error) { + emptyResult := &v1alpha1.PediaClusterLifecycle{} obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(pediaclusterlifecyclesResource, name, pt, data, subresources...), &v1alpha1.PediaClusterLifecycle{}) + Invokes(testing.NewRootPatchSubresourceActionWithOptions(pediaclusterlifecyclesResource, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.PediaClusterLifecycle), err } diff --git a/pkg/generated/clientset/versioned/typed/policy/v1alpha1/pediaclusterlifecycle.go b/pkg/generated/clientset/versioned/typed/policy/v1alpha1/pediaclusterlifecycle.go index 2979e6782..c3ef21707 100644 --- a/pkg/generated/clientset/versioned/typed/policy/v1alpha1/pediaclusterlifecycle.go +++ b/pkg/generated/clientset/versioned/typed/policy/v1alpha1/pediaclusterlifecycle.go @@ -4,14 +4,13 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "github.com/clusterpedia-io/api/policy/v1alpha1" scheme "github.com/clusterpedia-io/clusterpedia/pkg/generated/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // PediaClusterLifecyclesGetter has a method to return a PediaClusterLifecycleInterface. @@ -24,6 +23,7 @@ type PediaClusterLifecyclesGetter interface { type PediaClusterLifecycleInterface interface { Create(ctx context.Context, pediaClusterLifecycle *v1alpha1.PediaClusterLifecycle, opts v1.CreateOptions) (*v1alpha1.PediaClusterLifecycle, error) Update(ctx context.Context, pediaClusterLifecycle *v1alpha1.PediaClusterLifecycle, opts v1.UpdateOptions) (*v1alpha1.PediaClusterLifecycle, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, pediaClusterLifecycle *v1alpha1.PediaClusterLifecycle, opts v1.UpdateOptions) (*v1alpha1.PediaClusterLifecycle, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -36,133 +36,18 @@ type PediaClusterLifecycleInterface interface { // pediaClusterLifecycles implements PediaClusterLifecycleInterface type pediaClusterLifecycles struct { - client rest.Interface + *gentype.ClientWithList[*v1alpha1.PediaClusterLifecycle, *v1alpha1.PediaClusterLifecycleList] } // newPediaClusterLifecycles returns a PediaClusterLifecycles func newPediaClusterLifecycles(c *PolicyV1alpha1Client) *pediaClusterLifecycles { return &pediaClusterLifecycles{ - client: c.RESTClient(), + gentype.NewClientWithList[*v1alpha1.PediaClusterLifecycle, *v1alpha1.PediaClusterLifecycleList]( + "pediaclusterlifecycles", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *v1alpha1.PediaClusterLifecycle { return &v1alpha1.PediaClusterLifecycle{} }, + func() *v1alpha1.PediaClusterLifecycleList { return &v1alpha1.PediaClusterLifecycleList{} }), } } - -// Get takes name of the pediaClusterLifecycle, and returns the corresponding pediaClusterLifecycle object, and an error if there is any. -func (c *pediaClusterLifecycles) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.PediaClusterLifecycle, err error) { - result = &v1alpha1.PediaClusterLifecycle{} - err = c.client.Get(). - Resource("pediaclusterlifecycles"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of PediaClusterLifecycles that match those selectors. -func (c *pediaClusterLifecycles) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.PediaClusterLifecycleList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.PediaClusterLifecycleList{} - err = c.client.Get(). - Resource("pediaclusterlifecycles"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested pediaClusterLifecycles. -func (c *pediaClusterLifecycles) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("pediaclusterlifecycles"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a pediaClusterLifecycle and creates it. Returns the server's representation of the pediaClusterLifecycle, and an error, if there is any. -func (c *pediaClusterLifecycles) Create(ctx context.Context, pediaClusterLifecycle *v1alpha1.PediaClusterLifecycle, opts v1.CreateOptions) (result *v1alpha1.PediaClusterLifecycle, err error) { - result = &v1alpha1.PediaClusterLifecycle{} - err = c.client.Post(). - Resource("pediaclusterlifecycles"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(pediaClusterLifecycle). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a pediaClusterLifecycle and updates it. Returns the server's representation of the pediaClusterLifecycle, and an error, if there is any. -func (c *pediaClusterLifecycles) Update(ctx context.Context, pediaClusterLifecycle *v1alpha1.PediaClusterLifecycle, opts v1.UpdateOptions) (result *v1alpha1.PediaClusterLifecycle, err error) { - result = &v1alpha1.PediaClusterLifecycle{} - err = c.client.Put(). - Resource("pediaclusterlifecycles"). - Name(pediaClusterLifecycle.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(pediaClusterLifecycle). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *pediaClusterLifecycles) UpdateStatus(ctx context.Context, pediaClusterLifecycle *v1alpha1.PediaClusterLifecycle, opts v1.UpdateOptions) (result *v1alpha1.PediaClusterLifecycle, err error) { - result = &v1alpha1.PediaClusterLifecycle{} - err = c.client.Put(). - Resource("pediaclusterlifecycles"). - Name(pediaClusterLifecycle.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(pediaClusterLifecycle). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the pediaClusterLifecycle and deletes it. Returns an error if one occurs. -func (c *pediaClusterLifecycles) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("pediaclusterlifecycles"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *pediaClusterLifecycles) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("pediaclusterlifecycles"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched pediaClusterLifecycle. -func (c *pediaClusterLifecycles) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.PediaClusterLifecycle, err error) { - result = &v1alpha1.PediaClusterLifecycle{} - err = c.client.Patch(pt). - Resource("pediaclusterlifecycles"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/generated/informers/externalversions/factory.go b/pkg/generated/informers/externalversions/factory.go index 7c65c9bed..415a9b997 100644 --- a/pkg/generated/informers/externalversions/factory.go +++ b/pkg/generated/informers/externalversions/factory.go @@ -213,6 +213,7 @@ type SharedInformerFactory interface { // Start initializes all requested informers. They are handled in goroutines // which run until the stop channel gets closed. + // Warning: Start does not block. When run in a go-routine, it will race with a later WaitForCacheSync. Start(stopCh <-chan struct{}) // Shutdown marks a factory as shutting down. At that point no new diff --git a/pkg/generated/listers/cluster/v1alpha2/clustersyncresources.go b/pkg/generated/listers/cluster/v1alpha2/clustersyncresources.go index 69ffe1ba4..796fff344 100644 --- a/pkg/generated/listers/cluster/v1alpha2/clustersyncresources.go +++ b/pkg/generated/listers/cluster/v1alpha2/clustersyncresources.go @@ -4,8 +4,8 @@ package v1alpha2 import ( v1alpha2 "github.com/clusterpedia-io/api/cluster/v1alpha2" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -23,30 +23,10 @@ type ClusterSyncResourcesLister interface { // clusterSyncResourcesLister implements the ClusterSyncResourcesLister interface. type clusterSyncResourcesLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha2.ClusterSyncResources] } // NewClusterSyncResourcesLister returns a new ClusterSyncResourcesLister. func NewClusterSyncResourcesLister(indexer cache.Indexer) ClusterSyncResourcesLister { - return &clusterSyncResourcesLister{indexer: indexer} -} - -// List lists all ClusterSyncResources in the indexer. -func (s *clusterSyncResourcesLister) List(selector labels.Selector) (ret []*v1alpha2.ClusterSyncResources, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.ClusterSyncResources)) - }) - return ret, err -} - -// Get retrieves the ClusterSyncResources from the index for a given name. -func (s *clusterSyncResourcesLister) Get(name string) (*v1alpha2.ClusterSyncResources, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha2.Resource("clustersyncresources"), name) - } - return obj.(*v1alpha2.ClusterSyncResources), nil + return &clusterSyncResourcesLister{listers.New[*v1alpha2.ClusterSyncResources](indexer, v1alpha2.Resource("clustersyncresources"))} } diff --git a/pkg/generated/listers/cluster/v1alpha2/pediacluster.go b/pkg/generated/listers/cluster/v1alpha2/pediacluster.go index 6b3ff5ce9..09c865991 100644 --- a/pkg/generated/listers/cluster/v1alpha2/pediacluster.go +++ b/pkg/generated/listers/cluster/v1alpha2/pediacluster.go @@ -4,8 +4,8 @@ package v1alpha2 import ( v1alpha2 "github.com/clusterpedia-io/api/cluster/v1alpha2" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -23,30 +23,10 @@ type PediaClusterLister interface { // pediaClusterLister implements the PediaClusterLister interface. type pediaClusterLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha2.PediaCluster] } // NewPediaClusterLister returns a new PediaClusterLister. func NewPediaClusterLister(indexer cache.Indexer) PediaClusterLister { - return &pediaClusterLister{indexer: indexer} -} - -// List lists all PediaClusters in the indexer. -func (s *pediaClusterLister) List(selector labels.Selector) (ret []*v1alpha2.PediaCluster, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.PediaCluster)) - }) - return ret, err -} - -// Get retrieves the PediaCluster from the index for a given name. -func (s *pediaClusterLister) Get(name string) (*v1alpha2.PediaCluster, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha2.Resource("pediacluster"), name) - } - return obj.(*v1alpha2.PediaCluster), nil + return &pediaClusterLister{listers.New[*v1alpha2.PediaCluster](indexer, v1alpha2.Resource("pediacluster"))} } diff --git a/pkg/generated/listers/policy/v1alpha1/clusterimportpolicy.go b/pkg/generated/listers/policy/v1alpha1/clusterimportpolicy.go index 0e58f1019..c6f5f6aee 100644 --- a/pkg/generated/listers/policy/v1alpha1/clusterimportpolicy.go +++ b/pkg/generated/listers/policy/v1alpha1/clusterimportpolicy.go @@ -4,8 +4,8 @@ package v1alpha1 import ( v1alpha1 "github.com/clusterpedia-io/api/policy/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -23,30 +23,10 @@ type ClusterImportPolicyLister interface { // clusterImportPolicyLister implements the ClusterImportPolicyLister interface. type clusterImportPolicyLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.ClusterImportPolicy] } // NewClusterImportPolicyLister returns a new ClusterImportPolicyLister. func NewClusterImportPolicyLister(indexer cache.Indexer) ClusterImportPolicyLister { - return &clusterImportPolicyLister{indexer: indexer} -} - -// List lists all ClusterImportPolicies in the indexer. -func (s *clusterImportPolicyLister) List(selector labels.Selector) (ret []*v1alpha1.ClusterImportPolicy, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.ClusterImportPolicy)) - }) - return ret, err -} - -// Get retrieves the ClusterImportPolicy from the index for a given name. -func (s *clusterImportPolicyLister) Get(name string) (*v1alpha1.ClusterImportPolicy, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("clusterimportpolicy"), name) - } - return obj.(*v1alpha1.ClusterImportPolicy), nil + return &clusterImportPolicyLister{listers.New[*v1alpha1.ClusterImportPolicy](indexer, v1alpha1.Resource("clusterimportpolicy"))} } diff --git a/pkg/generated/listers/policy/v1alpha1/pediaclusterlifecycle.go b/pkg/generated/listers/policy/v1alpha1/pediaclusterlifecycle.go index 24d6a07fa..2db319148 100644 --- a/pkg/generated/listers/policy/v1alpha1/pediaclusterlifecycle.go +++ b/pkg/generated/listers/policy/v1alpha1/pediaclusterlifecycle.go @@ -4,8 +4,8 @@ package v1alpha1 import ( v1alpha1 "github.com/clusterpedia-io/api/policy/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -23,30 +23,10 @@ type PediaClusterLifecycleLister interface { // pediaClusterLifecycleLister implements the PediaClusterLifecycleLister interface. type pediaClusterLifecycleLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.PediaClusterLifecycle] } // NewPediaClusterLifecycleLister returns a new PediaClusterLifecycleLister. func NewPediaClusterLifecycleLister(indexer cache.Indexer) PediaClusterLifecycleLister { - return &pediaClusterLifecycleLister{indexer: indexer} -} - -// List lists all PediaClusterLifecycles in the indexer. -func (s *pediaClusterLifecycleLister) List(selector labels.Selector) (ret []*v1alpha1.PediaClusterLifecycle, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.PediaClusterLifecycle)) - }) - return ret, err -} - -// Get retrieves the PediaClusterLifecycle from the index for a given name. -func (s *pediaClusterLifecycleLister) Get(name string) (*v1alpha1.PediaClusterLifecycle, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("pediaclusterlifecycle"), name) - } - return obj.(*v1alpha1.PediaClusterLifecycle), nil + return &pediaClusterLifecycleLister{listers.New[*v1alpha1.PediaClusterLifecycle](indexer, v1alpha1.Resource("pediaclusterlifecycle"))} } diff --git a/pkg/generated/openapi/zz_generated.openapi.go b/pkg/generated/openapi/zz_generated.openapi.go index 2fd41d6a1..4da61730b 100644 --- a/pkg/generated/openapi/zz_generated.openapi.go +++ b/pkg/generated/openapi/zz_generated.openapi.go @@ -53,6 +53,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "k8s.io/apimachinery/pkg/apis/meta/v1.CreateOptions": schema_pkg_apis_meta_v1_CreateOptions(ref), "k8s.io/apimachinery/pkg/apis/meta/v1.DeleteOptions": schema_pkg_apis_meta_v1_DeleteOptions(ref), "k8s.io/apimachinery/pkg/apis/meta/v1.Duration": schema_pkg_apis_meta_v1_Duration(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.FieldSelectorRequirement": schema_pkg_apis_meta_v1_FieldSelectorRequirement(ref), "k8s.io/apimachinery/pkg/apis/meta/v1.FieldsV1": schema_pkg_apis_meta_v1_FieldsV1(ref), "k8s.io/apimachinery/pkg/apis/meta/v1.GetOptions": schema_pkg_apis_meta_v1_GetOptions(ref), "k8s.io/apimachinery/pkg/apis/meta/v1.GroupKind": schema_pkg_apis_meta_v1_GroupKind(ref), @@ -2351,6 +2352,56 @@ func schema_pkg_apis_meta_v1_Duration(ref common.ReferenceCallback) common.OpenA } } +func schema_pkg_apis_meta_v1_FieldSelectorRequirement(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "FieldSelectorRequirement is a selector that contains values, a key, and an operator that relates the key and values.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "key": { + SchemaProps: spec.SchemaProps{ + Description: "key is the field selector key that the requirement applies to.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "operator": { + SchemaProps: spec.SchemaProps{ + Description: "operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. The list of operators may grow in the future.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "values": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + Required: []string{"key", "operator"}, + }, + }, + } +} + func schema_pkg_apis_meta_v1_FieldsV1(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{