Update generated code

pull/1569/head
Darren Shepherd 5 years ago committed by Erik Wilson
parent a8d96112d9
commit dfcbd5a3c1

@ -59,7 +59,7 @@ func NewForConfig(c *rest.Config) (*Clientset, error) {
configShallowCopy := *c
if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 {
if configShallowCopy.Burst <= 0 {
return nil, fmt.Errorf("Burst is required to be greater than 0 when RateLimiter is not set and QPS is set to greater than 0")
return nil, fmt.Errorf("burst is required to be greater than 0 when RateLimiter is not set and QPS is set to greater than 0")
}
configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst)
}

@ -19,6 +19,7 @@ limitations under the License.
package v1
import (
"context"
"time"
v1 "github.com/rancher/k3s/pkg/apis/k3s.cattle.io/v1"
@ -37,15 +38,15 @@ type AddonsGetter interface {
// AddonInterface has methods to work with Addon resources.
type AddonInterface interface {
Create(*v1.Addon) (*v1.Addon, error)
Update(*v1.Addon) (*v1.Addon, error)
UpdateStatus(*v1.Addon) (*v1.Addon, error)
Delete(name string, options *metav1.DeleteOptions) error
DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error
Get(name string, options metav1.GetOptions) (*v1.Addon, error)
List(opts metav1.ListOptions) (*v1.AddonList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Addon, err error)
Create(ctx context.Context, addon *v1.Addon, opts metav1.CreateOptions) (*v1.Addon, error)
Update(ctx context.Context, addon *v1.Addon, opts metav1.UpdateOptions) (*v1.Addon, error)
UpdateStatus(ctx context.Context, addon *v1.Addon, opts metav1.UpdateOptions) (*v1.Addon, error)
Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error
Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Addon, error)
List(ctx context.Context, opts metav1.ListOptions) (*v1.AddonList, error)
Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Addon, err error)
AddonExpansion
}
@ -64,20 +65,20 @@ func newAddons(c *K3sV1Client, namespace string) *addons {
}
// Get takes name of the addon, and returns the corresponding addon object, and an error if there is any.
func (c *addons) Get(name string, options metav1.GetOptions) (result *v1.Addon, err error) {
func (c *addons) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Addon, err error) {
result = &v1.Addon{}
err = c.client.Get().
Namespace(c.ns).
Resource("addons").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of Addons that match those selectors.
func (c *addons) List(opts metav1.ListOptions) (result *v1.AddonList, err error) {
func (c *addons) List(ctx context.Context, opts metav1.ListOptions) (result *v1.AddonList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
@ -88,13 +89,13 @@ func (c *addons) List(opts metav1.ListOptions) (result *v1.AddonList, err error)
Resource("addons").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do().
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested addons.
func (c *addons) Watch(opts metav1.ListOptions) (watch.Interface, error) {
func (c *addons) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
@ -105,87 +106,90 @@ func (c *addons) Watch(opts metav1.ListOptions) (watch.Interface, error) {
Resource("addons").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch()
Watch(ctx)
}
// Create takes the representation of a addon and creates it. Returns the server's representation of the addon, and an error, if there is any.
func (c *addons) Create(addon *v1.Addon) (result *v1.Addon, err error) {
func (c *addons) Create(ctx context.Context, addon *v1.Addon, opts metav1.CreateOptions) (result *v1.Addon, err error) {
result = &v1.Addon{}
err = c.client.Post().
Namespace(c.ns).
Resource("addons").
VersionedParams(&opts, scheme.ParameterCodec).
Body(addon).
Do().
Do(ctx).
Into(result)
return
}
// Update takes the representation of a addon and updates it. Returns the server's representation of the addon, and an error, if there is any.
func (c *addons) Update(addon *v1.Addon) (result *v1.Addon, err error) {
func (c *addons) Update(ctx context.Context, addon *v1.Addon, opts metav1.UpdateOptions) (result *v1.Addon, err error) {
result = &v1.Addon{}
err = c.client.Put().
Namespace(c.ns).
Resource("addons").
Name(addon.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(addon).
Do().
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 *addons) UpdateStatus(addon *v1.Addon) (result *v1.Addon, err error) {
func (c *addons) UpdateStatus(ctx context.Context, addon *v1.Addon, opts metav1.UpdateOptions) (result *v1.Addon, err error) {
result = &v1.Addon{}
err = c.client.Put().
Namespace(c.ns).
Resource("addons").
Name(addon.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(addon).
Do().
Do(ctx).
Into(result)
return
}
// Delete takes name of the addon and deletes it. Returns an error if one occurs.
func (c *addons) Delete(name string, options *metav1.DeleteOptions) error {
func (c *addons) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("addons").
Name(name).
Body(options).
Do().
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *addons) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error {
func (c *addons) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
var timeout time.Duration
if listOptions.TimeoutSeconds != nil {
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("addons").
VersionedParams(&listOptions, scheme.ParameterCodec).
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(options).
Do().
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched addon.
func (c *addons) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Addon, err error) {
func (c *addons) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Addon, err error) {
result = &v1.Addon{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("addons").
SubResource(subresources...).
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do().
Do(ctx).
Into(result)
return
}

@ -19,6 +19,8 @@ limitations under the License.
package fake
import (
"context"
k3scattleiov1 "github.com/rancher/k3s/pkg/apis/k3s.cattle.io/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
@ -39,7 +41,7 @@ var addonsResource = schema.GroupVersionResource{Group: "k3s.cattle.io", Version
var addonsKind = schema.GroupVersionKind{Group: "k3s.cattle.io", Version: "v1", Kind: "Addon"}
// Get takes name of the addon, and returns the corresponding addon object, and an error if there is any.
func (c *FakeAddons) Get(name string, options v1.GetOptions) (result *k3scattleiov1.Addon, err error) {
func (c *FakeAddons) Get(ctx context.Context, name string, options v1.GetOptions) (result *k3scattleiov1.Addon, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(addonsResource, c.ns, name), &k3scattleiov1.Addon{})
@ -50,7 +52,7 @@ func (c *FakeAddons) Get(name string, options v1.GetOptions) (result *k3scattlei
}
// List takes label and field selectors, and returns the list of Addons that match those selectors.
func (c *FakeAddons) List(opts v1.ListOptions) (result *k3scattleiov1.AddonList, err error) {
func (c *FakeAddons) List(ctx context.Context, opts v1.ListOptions) (result *k3scattleiov1.AddonList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(addonsResource, addonsKind, c.ns, opts), &k3scattleiov1.AddonList{})
@ -72,14 +74,14 @@ func (c *FakeAddons) List(opts v1.ListOptions) (result *k3scattleiov1.AddonList,
}
// Watch returns a watch.Interface that watches the requested addons.
func (c *FakeAddons) Watch(opts v1.ListOptions) (watch.Interface, error) {
func (c *FakeAddons) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(addonsResource, c.ns, opts))
}
// Create takes the representation of a addon and creates it. Returns the server's representation of the addon, and an error, if there is any.
func (c *FakeAddons) Create(addon *k3scattleiov1.Addon) (result *k3scattleiov1.Addon, err error) {
func (c *FakeAddons) Create(ctx context.Context, addon *k3scattleiov1.Addon, opts v1.CreateOptions) (result *k3scattleiov1.Addon, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(addonsResource, c.ns, addon), &k3scattleiov1.Addon{})
@ -90,7 +92,7 @@ func (c *FakeAddons) Create(addon *k3scattleiov1.Addon) (result *k3scattleiov1.A
}
// Update takes the representation of a addon and updates it. Returns the server's representation of the addon, and an error, if there is any.
func (c *FakeAddons) Update(addon *k3scattleiov1.Addon) (result *k3scattleiov1.Addon, err error) {
func (c *FakeAddons) Update(ctx context.Context, addon *k3scattleiov1.Addon, opts v1.UpdateOptions) (result *k3scattleiov1.Addon, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(addonsResource, c.ns, addon), &k3scattleiov1.Addon{})
@ -102,7 +104,7 @@ func (c *FakeAddons) Update(addon *k3scattleiov1.Addon) (result *k3scattleiov1.A
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *FakeAddons) UpdateStatus(addon *k3scattleiov1.Addon) (*k3scattleiov1.Addon, error) {
func (c *FakeAddons) UpdateStatus(ctx context.Context, addon *k3scattleiov1.Addon, opts v1.UpdateOptions) (*k3scattleiov1.Addon, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(addonsResource, "status", c.ns, addon), &k3scattleiov1.Addon{})
@ -113,7 +115,7 @@ func (c *FakeAddons) UpdateStatus(addon *k3scattleiov1.Addon) (*k3scattleiov1.Ad
}
// Delete takes name of the addon and deletes it. Returns an error if one occurs.
func (c *FakeAddons) Delete(name string, options *v1.DeleteOptions) error {
func (c *FakeAddons) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(addonsResource, c.ns, name), &k3scattleiov1.Addon{})
@ -121,15 +123,15 @@ func (c *FakeAddons) Delete(name string, options *v1.DeleteOptions) error {
}
// DeleteCollection deletes a collection of objects.
func (c *FakeAddons) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(addonsResource, c.ns, listOptions)
func (c *FakeAddons) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(addonsResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &k3scattleiov1.AddonList{})
return err
}
// Patch applies the patch and returns the patched addon.
func (c *FakeAddons) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *k3scattleiov1.Addon, err error) {
func (c *FakeAddons) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *k3scattleiov1.Addon, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(addonsResource, c.ns, name, pt, data, subresources...), &k3scattleiov1.Addon{})

@ -176,35 +176,38 @@ func (c *addonController) Cache() AddonCache {
}
func (c *addonController) Create(obj *v1.Addon) (*v1.Addon, error) {
return c.clientGetter.Addons(obj.Namespace).Create(obj)
return c.clientGetter.Addons(obj.Namespace).Create(context.TODO(), obj, metav1.CreateOptions{})
}
func (c *addonController) Update(obj *v1.Addon) (*v1.Addon, error) {
return c.clientGetter.Addons(obj.Namespace).Update(obj)
return c.clientGetter.Addons(obj.Namespace).Update(context.TODO(), obj, metav1.UpdateOptions{})
}
func (c *addonController) UpdateStatus(obj *v1.Addon) (*v1.Addon, error) {
return c.clientGetter.Addons(obj.Namespace).UpdateStatus(obj)
return c.clientGetter.Addons(obj.Namespace).UpdateStatus(context.TODO(), obj, metav1.UpdateOptions{})
}
func (c *addonController) Delete(namespace, name string, options *metav1.DeleteOptions) error {
return c.clientGetter.Addons(namespace).Delete(name, options)
if options == nil {
options = &metav1.DeleteOptions{}
}
return c.clientGetter.Addons(namespace).Delete(context.TODO(), name, *options)
}
func (c *addonController) Get(namespace, name string, options metav1.GetOptions) (*v1.Addon, error) {
return c.clientGetter.Addons(namespace).Get(name, options)
return c.clientGetter.Addons(namespace).Get(context.TODO(), name, options)
}
func (c *addonController) List(namespace string, opts metav1.ListOptions) (*v1.AddonList, error) {
return c.clientGetter.Addons(namespace).List(opts)
return c.clientGetter.Addons(namespace).List(context.TODO(), opts)
}
func (c *addonController) Watch(namespace string, opts metav1.ListOptions) (watch.Interface, error) {
return c.clientGetter.Addons(namespace).Watch(opts)
return c.clientGetter.Addons(namespace).Watch(context.TODO(), opts)
}
func (c *addonController) Patch(namespace, name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Addon, err error) {
return c.clientGetter.Addons(namespace).Patch(name, pt, data, subresources...)
return c.clientGetter.Addons(namespace).Patch(context.TODO(), name, pt, data, metav1.PatchOptions{}, subresources...)
}
type addonCache struct {
@ -233,6 +236,7 @@ func (c *addonCache) GetByIndex(indexName, key string) (result []*v1.Addon, err
if err != nil {
return nil, err
}
result = make([]*v1.Addon, 0, len(objs))
for _, obj := range objs {
result = append(result, obj.(*v1.Addon))
}

@ -19,6 +19,7 @@ limitations under the License.
package v1
import (
"context"
time "time"
k3scattleiov1 "github.com/rancher/k3s/pkg/apis/k3s.cattle.io/v1"
@ -61,13 +62,13 @@ func NewFilteredAddonInformer(client versioned.Interface, namespace string, resy
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.K3sV1().Addons(namespace).List(options)
return client.K3sV1().Addons(namespace).List(context.TODO(), options)
},
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.K3sV1().Addons(namespace).Watch(options)
return client.K3sV1().Addons(namespace).Watch(context.TODO(), options)
},
},
&k3scattleiov1.Addon{},

Loading…
Cancel
Save