sample-controller: generate UpdateStatus for Foo resource

Kubernetes-commit: 68db7fe8b040d43fc2b888f1331b2845c31a201b
This commit is contained in:
Nikhita Raghunath 2018-02-18 18:48:53 +05:30 committed by Kubernetes Publisher
parent ad67096f17
commit 5bc8a4494b
2 changed files with 29 additions and 0 deletions

View File

@ -100,6 +100,18 @@ func (c *FakeFoos) Update(foo *v1alpha1.Foo) (result *v1alpha1.Foo, err error) {
return obj.(*v1alpha1.Foo), 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(foo *v1alpha1.Foo) (*v1alpha1.Foo, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(foosResource, "status", c.ns, foo), &v1alpha1.Foo{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Foo), err
}
// Delete takes name of the foo and deletes it. Returns an error if one occurs. // Delete takes name of the foo and deletes it. Returns an error if one occurs.
func (c *FakeFoos) Delete(name string, options *v1.DeleteOptions) error { func (c *FakeFoos) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake. _, err := c.Fake.

View File

@ -37,6 +37,7 @@ type FoosGetter interface {
type FooInterface interface { type FooInterface interface {
Create(*v1alpha1.Foo) (*v1alpha1.Foo, error) Create(*v1alpha1.Foo) (*v1alpha1.Foo, error)
Update(*v1alpha1.Foo) (*v1alpha1.Foo, error) Update(*v1alpha1.Foo) (*v1alpha1.Foo, error)
UpdateStatus(*v1alpha1.Foo) (*v1alpha1.Foo, error)
Delete(name string, options *v1.DeleteOptions) error Delete(name string, options *v1.DeleteOptions) error
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(name string, options v1.GetOptions) (*v1alpha1.Foo, error) Get(name string, options v1.GetOptions) (*v1alpha1.Foo, error)
@ -120,6 +121,22 @@ func (c *foos) Update(foo *v1alpha1.Foo) (result *v1alpha1.Foo, err error) {
return 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 *foos) UpdateStatus(foo *v1alpha1.Foo) (result *v1alpha1.Foo, err error) {
result = &v1alpha1.Foo{}
err = c.client.Put().
Namespace(c.ns).
Resource("foos").
Name(foo.Name).
SubResource("status").
Body(foo).
Do().
Into(result)
return
}
// Delete takes name of the foo and deletes it. Returns an error if one occurs. // Delete takes name of the foo and deletes it. Returns an error if one occurs.
func (c *foos) Delete(name string, options *v1.DeleteOptions) error { func (c *foos) Delete(name string, options *v1.DeleteOptions) error {
return c.client.Delete(). return c.client.Delete().