generated: update clients

Kubernetes-commit: 9443a3814446ecca4905f7ac7059c67f120151b9
This commit is contained in:
Mike Danese 2020-02-04 10:13:30 -08:00 committed by Kubernetes Publisher
parent 297436d318
commit d83890112b
2 changed files with 38 additions and 36 deletions

View File

@ -19,6 +19,8 @@ limitations under the License.
package fake
import (
"context"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
@ -39,7 +41,7 @@ var foosResource = schema.GroupVersionResource{Group: "samplecontroller.k8s.io",
var foosKind = schema.GroupVersionKind{Group: "samplecontroller.k8s.io", Version: "v1alpha1", Kind: "Foo"}
// Get takes name of the foo, and returns the corresponding foo object, and an error if there is any.
func (c *FakeFoos) Get(name string, options v1.GetOptions) (result *v1alpha1.Foo, err error) {
func (c *FakeFoos) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Foo, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(foosResource, c.ns, name), &v1alpha1.Foo{})
@ -50,7 +52,7 @@ func (c *FakeFoos) Get(name string, options v1.GetOptions) (result *v1alpha1.Foo
}
// List takes label and field selectors, and returns the list of Foos that match those selectors.
func (c *FakeFoos) List(opts v1.ListOptions) (result *v1alpha1.FooList, err error) {
func (c *FakeFoos) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.FooList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(foosResource, foosKind, c.ns, opts), &v1alpha1.FooList{})
@ -72,14 +74,14 @@ func (c *FakeFoos) List(opts v1.ListOptions) (result *v1alpha1.FooList, err erro
}
// Watch returns a watch.Interface that watches the requested foos.
func (c *FakeFoos) Watch(opts v1.ListOptions) (watch.Interface, error) {
func (c *FakeFoos) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(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(foo *v1alpha1.Foo) (result *v1alpha1.Foo, err error) {
func (c *FakeFoos) Create(ctx context.Context, foo *v1alpha1.Foo) (result *v1alpha1.Foo, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(foosResource, c.ns, foo), &v1alpha1.Foo{})
@ -90,7 +92,7 @@ func (c *FakeFoos) Create(foo *v1alpha1.Foo) (result *v1alpha1.Foo, err error) {
}
// 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(foo *v1alpha1.Foo) (result *v1alpha1.Foo, err error) {
func (c *FakeFoos) Update(ctx context.Context, foo *v1alpha1.Foo) (result *v1alpha1.Foo, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(foosResource, c.ns, foo), &v1alpha1.Foo{})
@ -102,7 +104,7 @@ func (c *FakeFoos) Update(foo *v1alpha1.Foo) (result *v1alpha1.Foo, err error) {
// 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) {
func (c *FakeFoos) UpdateStatus(ctx context.Context, foo *v1alpha1.Foo) (*v1alpha1.Foo, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(foosResource, "status", c.ns, foo), &v1alpha1.Foo{})
@ -113,7 +115,7 @@ func (c *FakeFoos) UpdateStatus(foo *v1alpha1.Foo) (*v1alpha1.Foo, error) {
}
// 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(ctx context.Context, name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(foosResource, c.ns, name), &v1alpha1.Foo{})
@ -121,7 +123,7 @@ func (c *FakeFoos) Delete(name string, options *v1.DeleteOptions) error {
}
// DeleteCollection deletes a collection of objects.
func (c *FakeFoos) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
func (c *FakeFoos) DeleteCollection(ctx context.Context, options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(foosResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &v1alpha1.FooList{})
@ -129,7 +131,7 @@ func (c *FakeFoos) DeleteCollection(options *v1.DeleteOptions, listOptions v1.Li
}
// Patch applies the patch and returns the patched foo.
func (c *FakeFoos) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Foo, err error) {
func (c *FakeFoos) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Foo, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(foosResource, c.ns, name, pt, data, subresources...), &v1alpha1.Foo{})

View File

@ -38,15 +38,15 @@ type FoosGetter interface {
// FooInterface has methods to work with Foo resources.
type FooInterface interface {
Create(*v1alpha1.Foo) (*v1alpha1.Foo, error)
Update(*v1alpha1.Foo) (*v1alpha1.Foo, error)
UpdateStatus(*v1alpha1.Foo) (*v1alpha1.Foo, error)
Delete(name string, options *v1.DeleteOptions) error
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(name string, options v1.GetOptions) (*v1alpha1.Foo, error)
List(opts v1.ListOptions) (*v1alpha1.FooList, error)
Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Foo, err error)
Create(context.Context, *v1alpha1.Foo) (*v1alpha1.Foo, error)
Update(context.Context, *v1alpha1.Foo) (*v1alpha1.Foo, error)
UpdateStatus(context.Context, *v1alpha1.Foo) (*v1alpha1.Foo, error)
Delete(ctx context.Context, name string, options *v1.DeleteOptions) error
DeleteCollection(ctx context.Context, options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(ctx context.Context, name string, options v1.GetOptions) (*v1alpha1.Foo, error)
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.FooList, error)
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Foo, err error)
FooExpansion
}
@ -65,20 +65,20 @@ func newFoos(c *SamplecontrollerV1alpha1Client, namespace string) *foos {
}
// Get takes name of the foo, and returns the corresponding foo object, and an error if there is any.
func (c *foos) Get(name string, options v1.GetOptions) (result *v1alpha1.Foo, err error) {
func (c *foos) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Foo, err error) {
result = &v1alpha1.Foo{}
err = c.client.Get().
Namespace(c.ns).
Resource("foos").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(context.TODO()).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of Foos that match those selectors.
func (c *foos) List(opts v1.ListOptions) (result *v1alpha1.FooList, err error) {
func (c *foos) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.FooList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
@ -89,13 +89,13 @@ func (c *foos) List(opts v1.ListOptions) (result *v1alpha1.FooList, err error) {
Resource("foos").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(context.TODO()).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested foos.
func (c *foos) Watch(opts v1.ListOptions) (watch.Interface, error) {
func (c *foos) 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
@ -106,30 +106,30 @@ func (c *foos) Watch(opts v1.ListOptions) (watch.Interface, error) {
Resource("foos").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(context.TODO())
Watch(ctx)
}
// 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 *foos) Create(foo *v1alpha1.Foo) (result *v1alpha1.Foo, err error) {
func (c *foos) Create(ctx context.Context, foo *v1alpha1.Foo) (result *v1alpha1.Foo, err error) {
result = &v1alpha1.Foo{}
err = c.client.Post().
Namespace(c.ns).
Resource("foos").
Body(foo).
Do(context.TODO()).
Do(ctx).
Into(result)
return
}
// 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 *foos) Update(foo *v1alpha1.Foo) (result *v1alpha1.Foo, err error) {
func (c *foos) Update(ctx context.Context, foo *v1alpha1.Foo) (result *v1alpha1.Foo, err error) {
result = &v1alpha1.Foo{}
err = c.client.Put().
Namespace(c.ns).
Resource("foos").
Name(foo.Name).
Body(foo).
Do(context.TODO()).
Do(ctx).
Into(result)
return
}
@ -137,7 +137,7 @@ func (c *foos) Update(foo *v1alpha1.Foo) (result *v1alpha1.Foo, err error) {
// 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) {
func (c *foos) UpdateStatus(ctx context.Context, foo *v1alpha1.Foo) (result *v1alpha1.Foo, err error) {
result = &v1alpha1.Foo{}
err = c.client.Put().
Namespace(c.ns).
@ -145,24 +145,24 @@ func (c *foos) UpdateStatus(foo *v1alpha1.Foo) (result *v1alpha1.Foo, err error)
Name(foo.Name).
SubResource("status").
Body(foo).
Do(context.TODO()).
Do(ctx).
Into(result)
return
}
// 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(ctx context.Context, name string, options *v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("foos").
Name(name).
Body(options).
Do(context.TODO()).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *foos) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
func (c *foos) DeleteCollection(ctx context.Context, options *v1.DeleteOptions, listOptions v1.ListOptions) error {
var timeout time.Duration
if listOptions.TimeoutSeconds != nil {
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
@ -173,12 +173,12 @@ func (c *foos) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOp
VersionedParams(&listOptions, scheme.ParameterCodec).
Timeout(timeout).
Body(options).
Do(context.TODO()).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched foo.
func (c *foos) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Foo, err error) {
func (c *foos) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Foo, err error) {
result = &v1alpha1.Foo{}
err = c.client.Patch(pt).
Namespace(c.ns).
@ -186,7 +186,7 @@ func (c *foos) Patch(name string, pt types.PatchType, data []byte, subresources
SubResource(subresources...).
Name(name).
Body(data).
Do(context.TODO()).
Do(ctx).
Into(result)
return
}