mirror of
https://github.com/kubernetes/sample-controller.git
synced 2025-05-11 00:45:04 +08:00
generated: update clients
Kubernetes-commit: 9443a3814446ecca4905f7ac7059c67f120151b9
This commit is contained in:
parent
297436d318
commit
d83890112b
@ -19,6 +19,8 @@ limitations under the License.
|
|||||||
package fake
|
package fake
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
labels "k8s.io/apimachinery/pkg/labels"
|
labels "k8s.io/apimachinery/pkg/labels"
|
||||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
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"}
|
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.
|
// 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.
|
obj, err := c.Fake.
|
||||||
Invokes(testing.NewGetAction(foosResource, c.ns, name), &v1alpha1.Foo{})
|
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.
|
// 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.
|
obj, err := c.Fake.
|
||||||
Invokes(testing.NewListAction(foosResource, foosKind, c.ns, opts), &v1alpha1.FooList{})
|
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.
|
// 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.
|
return c.Fake.
|
||||||
InvokesWatch(testing.NewWatchAction(foosResource, c.ns, opts))
|
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.
|
// 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.
|
obj, err := c.Fake.
|
||||||
Invokes(testing.NewCreateAction(foosResource, c.ns, foo), &v1alpha1.Foo{})
|
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.
|
// 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.
|
obj, err := c.Fake.
|
||||||
Invokes(testing.NewUpdateAction(foosResource, c.ns, foo), &v1alpha1.Foo{})
|
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.
|
// UpdateStatus was generated because the type contains a Status member.
|
||||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
// 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.
|
obj, err := c.Fake.
|
||||||
Invokes(testing.NewUpdateSubresourceAction(foosResource, "status", c.ns, foo), &v1alpha1.Foo{})
|
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.
|
// 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.
|
_, err := c.Fake.
|
||||||
Invokes(testing.NewDeleteAction(foosResource, c.ns, name), &v1alpha1.Foo{})
|
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.
|
// 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)
|
action := testing.NewDeleteCollectionAction(foosResource, c.ns, listOptions)
|
||||||
|
|
||||||
_, err := c.Fake.Invokes(action, &v1alpha1.FooList{})
|
_, 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.
|
// 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.
|
obj, err := c.Fake.
|
||||||
Invokes(testing.NewPatchSubresourceAction(foosResource, c.ns, name, pt, data, subresources...), &v1alpha1.Foo{})
|
Invokes(testing.NewPatchSubresourceAction(foosResource, c.ns, name, pt, data, subresources...), &v1alpha1.Foo{})
|
||||||
|
|
||||||
|
@ -38,15 +38,15 @@ type FoosGetter interface {
|
|||||||
|
|
||||||
// FooInterface has methods to work with Foo resources.
|
// FooInterface has methods to work with Foo resources.
|
||||||
type FooInterface interface {
|
type FooInterface interface {
|
||||||
Create(*v1alpha1.Foo) (*v1alpha1.Foo, error)
|
Create(context.Context, *v1alpha1.Foo) (*v1alpha1.Foo, error)
|
||||||
Update(*v1alpha1.Foo) (*v1alpha1.Foo, error)
|
Update(context.Context, *v1alpha1.Foo) (*v1alpha1.Foo, error)
|
||||||
UpdateStatus(*v1alpha1.Foo) (*v1alpha1.Foo, error)
|
UpdateStatus(context.Context, *v1alpha1.Foo) (*v1alpha1.Foo, error)
|
||||||
Delete(name string, options *v1.DeleteOptions) error
|
Delete(ctx context.Context, name string, options *v1.DeleteOptions) error
|
||||||
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
|
DeleteCollection(ctx context.Context, options *v1.DeleteOptions, listOptions v1.ListOptions) error
|
||||||
Get(name string, options v1.GetOptions) (*v1alpha1.Foo, error)
|
Get(ctx context.Context, name string, options v1.GetOptions) (*v1alpha1.Foo, error)
|
||||||
List(opts v1.ListOptions) (*v1alpha1.FooList, error)
|
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.FooList, error)
|
||||||
Watch(opts v1.ListOptions) (watch.Interface, error)
|
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
|
||||||
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Foo, err error)
|
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Foo, err error)
|
||||||
FooExpansion
|
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.
|
// 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{}
|
result = &v1alpha1.Foo{}
|
||||||
err = c.client.Get().
|
err = c.client.Get().
|
||||||
Namespace(c.ns).
|
Namespace(c.ns).
|
||||||
Resource("foos").
|
Resource("foos").
|
||||||
Name(name).
|
Name(name).
|
||||||
VersionedParams(&options, scheme.ParameterCodec).
|
VersionedParams(&options, scheme.ParameterCodec).
|
||||||
Do(context.TODO()).
|
Do(ctx).
|
||||||
Into(result)
|
Into(result)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// List takes label and field selectors, and returns the list of Foos that match those selectors.
|
// 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
|
var timeout time.Duration
|
||||||
if opts.TimeoutSeconds != nil {
|
if opts.TimeoutSeconds != nil {
|
||||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
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").
|
Resource("foos").
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
Timeout(timeout).
|
Timeout(timeout).
|
||||||
Do(context.TODO()).
|
Do(ctx).
|
||||||
Into(result)
|
Into(result)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Watch returns a watch.Interface that watches the requested foos.
|
// 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
|
var timeout time.Duration
|
||||||
if opts.TimeoutSeconds != nil {
|
if opts.TimeoutSeconds != nil {
|
||||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||||
@ -106,30 +106,30 @@ func (c *foos) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
|||||||
Resource("foos").
|
Resource("foos").
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
Timeout(timeout).
|
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.
|
// 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{}
|
result = &v1alpha1.Foo{}
|
||||||
err = c.client.Post().
|
err = c.client.Post().
|
||||||
Namespace(c.ns).
|
Namespace(c.ns).
|
||||||
Resource("foos").
|
Resource("foos").
|
||||||
Body(foo).
|
Body(foo).
|
||||||
Do(context.TODO()).
|
Do(ctx).
|
||||||
Into(result)
|
Into(result)
|
||||||
return
|
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.
|
// 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{}
|
result = &v1alpha1.Foo{}
|
||||||
err = c.client.Put().
|
err = c.client.Put().
|
||||||
Namespace(c.ns).
|
Namespace(c.ns).
|
||||||
Resource("foos").
|
Resource("foos").
|
||||||
Name(foo.Name).
|
Name(foo.Name).
|
||||||
Body(foo).
|
Body(foo).
|
||||||
Do(context.TODO()).
|
Do(ctx).
|
||||||
Into(result)
|
Into(result)
|
||||||
return
|
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.
|
// UpdateStatus was generated because the type contains a Status member.
|
||||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
// 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{}
|
result = &v1alpha1.Foo{}
|
||||||
err = c.client.Put().
|
err = c.client.Put().
|
||||||
Namespace(c.ns).
|
Namespace(c.ns).
|
||||||
@ -145,24 +145,24 @@ func (c *foos) UpdateStatus(foo *v1alpha1.Foo) (result *v1alpha1.Foo, err error)
|
|||||||
Name(foo.Name).
|
Name(foo.Name).
|
||||||
SubResource("status").
|
SubResource("status").
|
||||||
Body(foo).
|
Body(foo).
|
||||||
Do(context.TODO()).
|
Do(ctx).
|
||||||
Into(result)
|
Into(result)
|
||||||
return
|
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(ctx context.Context, name string, options *v1.DeleteOptions) error {
|
||||||
return c.client.Delete().
|
return c.client.Delete().
|
||||||
Namespace(c.ns).
|
Namespace(c.ns).
|
||||||
Resource("foos").
|
Resource("foos").
|
||||||
Name(name).
|
Name(name).
|
||||||
Body(options).
|
Body(options).
|
||||||
Do(context.TODO()).
|
Do(ctx).
|
||||||
Error()
|
Error()
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteCollection deletes a collection of objects.
|
// 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
|
var timeout time.Duration
|
||||||
if listOptions.TimeoutSeconds != nil {
|
if listOptions.TimeoutSeconds != nil {
|
||||||
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
|
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).
|
VersionedParams(&listOptions, scheme.ParameterCodec).
|
||||||
Timeout(timeout).
|
Timeout(timeout).
|
||||||
Body(options).
|
Body(options).
|
||||||
Do(context.TODO()).
|
Do(ctx).
|
||||||
Error()
|
Error()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Patch applies the patch and returns the patched foo.
|
// 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{}
|
result = &v1alpha1.Foo{}
|
||||||
err = c.client.Patch(pt).
|
err = c.client.Patch(pt).
|
||||||
Namespace(c.ns).
|
Namespace(c.ns).
|
||||||
@ -186,7 +186,7 @@ func (c *foos) Patch(name string, pt types.PatchType, data []byte, subresources
|
|||||||
SubResource(subresources...).
|
SubResource(subresources...).
|
||||||
Name(name).
|
Name(name).
|
||||||
Body(data).
|
Body(data).
|
||||||
Do(context.TODO()).
|
Do(ctx).
|
||||||
Into(result)
|
Into(result)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user