From f90925cd12e07cfec3e161dd64cabba054f9a5e7 Mon Sep 17 00:00:00 2001 From: Pawan Date: Thu, 25 Jun 2020 00:00:21 +0530 Subject: [PATCH] autogen code Signed-off-by: Pawan --- .../zfs/v1/zz_generated.deepcopy.go | 152 ++++++++++++++ .../typed/zfs/v1/fake/fake_zfs_client.go | 8 + .../typed/zfs/v1/fake/fake_zfsbackup.go | 140 +++++++++++++ .../typed/zfs/v1/fake/fake_zfsrestore.go | 140 +++++++++++++ .../typed/zfs/v1/generated_expansion.go | 4 + .../typed/zfs/v1/zfs_client.go | 10 + .../typed/zfs/v1/zfsbackup.go | 191 ++++++++++++++++++ .../typed/zfs/v1/zfsrestore.go | 191 ++++++++++++++++++ .../informer/externalversions/generic.go | 4 + .../externalversions/zfs/v1/interface.go | 14 ++ .../externalversions/zfs/v1/zfsbackup.go | 89 ++++++++ .../externalversions/zfs/v1/zfsrestore.go | 89 ++++++++ .../lister/zfs/v1/expansion_generated.go | 16 ++ pkg/generated/lister/zfs/v1/zfsbackup.go | 94 +++++++++ pkg/generated/lister/zfs/v1/zfsrestore.go | 94 +++++++++ 15 files changed, 1236 insertions(+) create mode 100644 pkg/generated/clientset/internalclientset/typed/zfs/v1/fake/fake_zfsbackup.go create mode 100644 pkg/generated/clientset/internalclientset/typed/zfs/v1/fake/fake_zfsrestore.go create mode 100644 pkg/generated/clientset/internalclientset/typed/zfs/v1/zfsbackup.go create mode 100644 pkg/generated/clientset/internalclientset/typed/zfs/v1/zfsrestore.go create mode 100644 pkg/generated/informer/externalversions/zfs/v1/zfsbackup.go create mode 100644 pkg/generated/informer/externalversions/zfs/v1/zfsrestore.go create mode 100644 pkg/generated/lister/zfs/v1/zfsbackup.go create mode 100644 pkg/generated/lister/zfs/v1/zfsrestore.go diff --git a/pkg/apis/openebs.io/zfs/v1/zz_generated.deepcopy.go b/pkg/apis/openebs.io/zfs/v1/zz_generated.deepcopy.go index 9b5419aee..a6ac5dbf0 100644 --- a/pkg/apis/openebs.io/zfs/v1/zz_generated.deepcopy.go +++ b/pkg/apis/openebs.io/zfs/v1/zz_generated.deepcopy.go @@ -98,6 +98,158 @@ func (in *VolumeInfo) DeepCopy() *VolumeInfo { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ZFSBackup) DeepCopyInto(out *ZFSBackup) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ZFSBackup. +func (in *ZFSBackup) DeepCopy() *ZFSBackup { + if in == nil { + return nil + } + out := new(ZFSBackup) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ZFSBackup) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ZFSBackupList) DeepCopyInto(out *ZFSBackupList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ZFSBackup, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ZFSBackupList. +func (in *ZFSBackupList) DeepCopy() *ZFSBackupList { + if in == nil { + return nil + } + out := new(ZFSBackupList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ZFSBackupList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ZFSBackupSpec) DeepCopyInto(out *ZFSBackupSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ZFSBackupSpec. +func (in *ZFSBackupSpec) DeepCopy() *ZFSBackupSpec { + if in == nil { + return nil + } + out := new(ZFSBackupSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ZFSRestore) DeepCopyInto(out *ZFSRestore) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ZFSRestore. +func (in *ZFSRestore) DeepCopy() *ZFSRestore { + if in == nil { + return nil + } + out := new(ZFSRestore) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ZFSRestore) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ZFSRestoreList) DeepCopyInto(out *ZFSRestoreList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ZFSRestore, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ZFSRestoreList. +func (in *ZFSRestoreList) DeepCopy() *ZFSRestoreList { + if in == nil { + return nil + } + out := new(ZFSRestoreList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ZFSRestoreList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ZFSRestoreSpec) DeepCopyInto(out *ZFSRestoreSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ZFSRestoreSpec. +func (in *ZFSRestoreSpec) DeepCopy() *ZFSRestoreSpec { + if in == nil { + return nil + } + out := new(ZFSRestoreSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ZFSSnapshot) DeepCopyInto(out *ZFSSnapshot) { *out = *in diff --git a/pkg/generated/clientset/internalclientset/typed/zfs/v1/fake/fake_zfs_client.go b/pkg/generated/clientset/internalclientset/typed/zfs/v1/fake/fake_zfs_client.go index 5ad5582f0..21cb4018f 100644 --- a/pkg/generated/clientset/internalclientset/typed/zfs/v1/fake/fake_zfs_client.go +++ b/pkg/generated/clientset/internalclientset/typed/zfs/v1/fake/fake_zfs_client.go @@ -28,6 +28,14 @@ type FakeZfsV1 struct { *testing.Fake } +func (c *FakeZfsV1) ZFSBackups(namespace string) v1.ZFSBackupInterface { + return &FakeZFSBackups{c, namespace} +} + +func (c *FakeZfsV1) ZFSRestores(namespace string) v1.ZFSRestoreInterface { + return &FakeZFSRestores{c, namespace} +} + func (c *FakeZfsV1) ZFSSnapshots(namespace string) v1.ZFSSnapshotInterface { return &FakeZFSSnapshots{c, namespace} } diff --git a/pkg/generated/clientset/internalclientset/typed/zfs/v1/fake/fake_zfsbackup.go b/pkg/generated/clientset/internalclientset/typed/zfs/v1/fake/fake_zfsbackup.go new file mode 100644 index 000000000..a46952efd --- /dev/null +++ b/pkg/generated/clientset/internalclientset/typed/zfs/v1/fake/fake_zfsbackup.go @@ -0,0 +1,140 @@ +/* +Copyright 2019 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + zfsv1 "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeZFSBackups implements ZFSBackupInterface +type FakeZFSBackups struct { + Fake *FakeZfsV1 + ns string +} + +var zfsbackupsResource = schema.GroupVersionResource{Group: "zfs.openebs.io", Version: "v1", Resource: "zfsbackups"} + +var zfsbackupsKind = schema.GroupVersionKind{Group: "zfs.openebs.io", Version: "v1", Kind: "ZFSBackup"} + +// Get takes name of the zFSBackup, and returns the corresponding zFSBackup object, and an error if there is any. +func (c *FakeZFSBackups) Get(name string, options v1.GetOptions) (result *zfsv1.ZFSBackup, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(zfsbackupsResource, c.ns, name), &zfsv1.ZFSBackup{}) + + if obj == nil { + return nil, err + } + return obj.(*zfsv1.ZFSBackup), err +} + +// List takes label and field selectors, and returns the list of ZFSBackups that match those selectors. +func (c *FakeZFSBackups) List(opts v1.ListOptions) (result *zfsv1.ZFSBackupList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(zfsbackupsResource, zfsbackupsKind, c.ns, opts), &zfsv1.ZFSBackupList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &zfsv1.ZFSBackupList{ListMeta: obj.(*zfsv1.ZFSBackupList).ListMeta} + for _, item := range obj.(*zfsv1.ZFSBackupList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested zFSBackups. +func (c *FakeZFSBackups) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(zfsbackupsResource, c.ns, opts)) + +} + +// Create takes the representation of a zFSBackup and creates it. Returns the server's representation of the zFSBackup, and an error, if there is any. +func (c *FakeZFSBackups) Create(zFSBackup *zfsv1.ZFSBackup) (result *zfsv1.ZFSBackup, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(zfsbackupsResource, c.ns, zFSBackup), &zfsv1.ZFSBackup{}) + + if obj == nil { + return nil, err + } + return obj.(*zfsv1.ZFSBackup), err +} + +// Update takes the representation of a zFSBackup and updates it. Returns the server's representation of the zFSBackup, and an error, if there is any. +func (c *FakeZFSBackups) Update(zFSBackup *zfsv1.ZFSBackup) (result *zfsv1.ZFSBackup, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(zfsbackupsResource, c.ns, zFSBackup), &zfsv1.ZFSBackup{}) + + if obj == nil { + return nil, err + } + return obj.(*zfsv1.ZFSBackup), 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 *FakeZFSBackups) UpdateStatus(zFSBackup *zfsv1.ZFSBackup) (*zfsv1.ZFSBackup, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(zfsbackupsResource, "status", c.ns, zFSBackup), &zfsv1.ZFSBackup{}) + + if obj == nil { + return nil, err + } + return obj.(*zfsv1.ZFSBackup), err +} + +// Delete takes name of the zFSBackup and deletes it. Returns an error if one occurs. +func (c *FakeZFSBackups) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(zfsbackupsResource, c.ns, name), &zfsv1.ZFSBackup{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeZFSBackups) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(zfsbackupsResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &zfsv1.ZFSBackupList{}) + return err +} + +// Patch applies the patch and returns the patched zFSBackup. +func (c *FakeZFSBackups) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *zfsv1.ZFSBackup, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(zfsbackupsResource, c.ns, name, pt, data, subresources...), &zfsv1.ZFSBackup{}) + + if obj == nil { + return nil, err + } + return obj.(*zfsv1.ZFSBackup), err +} diff --git a/pkg/generated/clientset/internalclientset/typed/zfs/v1/fake/fake_zfsrestore.go b/pkg/generated/clientset/internalclientset/typed/zfs/v1/fake/fake_zfsrestore.go new file mode 100644 index 000000000..864525d17 --- /dev/null +++ b/pkg/generated/clientset/internalclientset/typed/zfs/v1/fake/fake_zfsrestore.go @@ -0,0 +1,140 @@ +/* +Copyright 2019 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + zfsv1 "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeZFSRestores implements ZFSRestoreInterface +type FakeZFSRestores struct { + Fake *FakeZfsV1 + ns string +} + +var zfsrestoresResource = schema.GroupVersionResource{Group: "zfs.openebs.io", Version: "v1", Resource: "zfsrestores"} + +var zfsrestoresKind = schema.GroupVersionKind{Group: "zfs.openebs.io", Version: "v1", Kind: "ZFSRestore"} + +// Get takes name of the zFSRestore, and returns the corresponding zFSRestore object, and an error if there is any. +func (c *FakeZFSRestores) Get(name string, options v1.GetOptions) (result *zfsv1.ZFSRestore, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(zfsrestoresResource, c.ns, name), &zfsv1.ZFSRestore{}) + + if obj == nil { + return nil, err + } + return obj.(*zfsv1.ZFSRestore), err +} + +// List takes label and field selectors, and returns the list of ZFSRestores that match those selectors. +func (c *FakeZFSRestores) List(opts v1.ListOptions) (result *zfsv1.ZFSRestoreList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(zfsrestoresResource, zfsrestoresKind, c.ns, opts), &zfsv1.ZFSRestoreList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &zfsv1.ZFSRestoreList{ListMeta: obj.(*zfsv1.ZFSRestoreList).ListMeta} + for _, item := range obj.(*zfsv1.ZFSRestoreList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested zFSRestores. +func (c *FakeZFSRestores) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(zfsrestoresResource, c.ns, opts)) + +} + +// Create takes the representation of a zFSRestore and creates it. Returns the server's representation of the zFSRestore, and an error, if there is any. +func (c *FakeZFSRestores) Create(zFSRestore *zfsv1.ZFSRestore) (result *zfsv1.ZFSRestore, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(zfsrestoresResource, c.ns, zFSRestore), &zfsv1.ZFSRestore{}) + + if obj == nil { + return nil, err + } + return obj.(*zfsv1.ZFSRestore), err +} + +// Update takes the representation of a zFSRestore and updates it. Returns the server's representation of the zFSRestore, and an error, if there is any. +func (c *FakeZFSRestores) Update(zFSRestore *zfsv1.ZFSRestore) (result *zfsv1.ZFSRestore, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(zfsrestoresResource, c.ns, zFSRestore), &zfsv1.ZFSRestore{}) + + if obj == nil { + return nil, err + } + return obj.(*zfsv1.ZFSRestore), 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 *FakeZFSRestores) UpdateStatus(zFSRestore *zfsv1.ZFSRestore) (*zfsv1.ZFSRestore, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(zfsrestoresResource, "status", c.ns, zFSRestore), &zfsv1.ZFSRestore{}) + + if obj == nil { + return nil, err + } + return obj.(*zfsv1.ZFSRestore), err +} + +// Delete takes name of the zFSRestore and deletes it. Returns an error if one occurs. +func (c *FakeZFSRestores) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(zfsrestoresResource, c.ns, name), &zfsv1.ZFSRestore{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeZFSRestores) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(zfsrestoresResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &zfsv1.ZFSRestoreList{}) + return err +} + +// Patch applies the patch and returns the patched zFSRestore. +func (c *FakeZFSRestores) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *zfsv1.ZFSRestore, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(zfsrestoresResource, c.ns, name, pt, data, subresources...), &zfsv1.ZFSRestore{}) + + if obj == nil { + return nil, err + } + return obj.(*zfsv1.ZFSRestore), err +} diff --git a/pkg/generated/clientset/internalclientset/typed/zfs/v1/generated_expansion.go b/pkg/generated/clientset/internalclientset/typed/zfs/v1/generated_expansion.go index 3c3bef919..bdfa5a5a4 100644 --- a/pkg/generated/clientset/internalclientset/typed/zfs/v1/generated_expansion.go +++ b/pkg/generated/clientset/internalclientset/typed/zfs/v1/generated_expansion.go @@ -18,6 +18,10 @@ limitations under the License. package v1 +type ZFSBackupExpansion interface{} + +type ZFSRestoreExpansion interface{} + type ZFSSnapshotExpansion interface{} type ZFSVolumeExpansion interface{} diff --git a/pkg/generated/clientset/internalclientset/typed/zfs/v1/zfs_client.go b/pkg/generated/clientset/internalclientset/typed/zfs/v1/zfs_client.go index 5be6062b8..e2f4daf94 100644 --- a/pkg/generated/clientset/internalclientset/typed/zfs/v1/zfs_client.go +++ b/pkg/generated/clientset/internalclientset/typed/zfs/v1/zfs_client.go @@ -26,6 +26,8 @@ import ( type ZfsV1Interface interface { RESTClient() rest.Interface + ZFSBackupsGetter + ZFSRestoresGetter ZFSSnapshotsGetter ZFSVolumesGetter } @@ -35,6 +37,14 @@ type ZfsV1Client struct { restClient rest.Interface } +func (c *ZfsV1Client) ZFSBackups(namespace string) ZFSBackupInterface { + return newZFSBackups(c, namespace) +} + +func (c *ZfsV1Client) ZFSRestores(namespace string) ZFSRestoreInterface { + return newZFSRestores(c, namespace) +} + func (c *ZfsV1Client) ZFSSnapshots(namespace string) ZFSSnapshotInterface { return newZFSSnapshots(c, namespace) } diff --git a/pkg/generated/clientset/internalclientset/typed/zfs/v1/zfsbackup.go b/pkg/generated/clientset/internalclientset/typed/zfs/v1/zfsbackup.go new file mode 100644 index 000000000..6187753bb --- /dev/null +++ b/pkg/generated/clientset/internalclientset/typed/zfs/v1/zfsbackup.go @@ -0,0 +1,191 @@ +/* +Copyright 2019 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +import ( + "time" + + v1 "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1" + scheme "github.com/openebs/zfs-localpv/pkg/generated/clientset/internalclientset/scheme" + metav1 "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" +) + +// ZFSBackupsGetter has a method to return a ZFSBackupInterface. +// A group's client should implement this interface. +type ZFSBackupsGetter interface { + ZFSBackups(namespace string) ZFSBackupInterface +} + +// ZFSBackupInterface has methods to work with ZFSBackup resources. +type ZFSBackupInterface interface { + Create(*v1.ZFSBackup) (*v1.ZFSBackup, error) + Update(*v1.ZFSBackup) (*v1.ZFSBackup, error) + UpdateStatus(*v1.ZFSBackup) (*v1.ZFSBackup, error) + Delete(name string, options *metav1.DeleteOptions) error + DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error + Get(name string, options metav1.GetOptions) (*v1.ZFSBackup, error) + List(opts metav1.ListOptions) (*v1.ZFSBackupList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ZFSBackup, err error) + ZFSBackupExpansion +} + +// zFSBackups implements ZFSBackupInterface +type zFSBackups struct { + client rest.Interface + ns string +} + +// newZFSBackups returns a ZFSBackups +func newZFSBackups(c *ZfsV1Client, namespace string) *zFSBackups { + return &zFSBackups{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the zFSBackup, and returns the corresponding zFSBackup object, and an error if there is any. +func (c *zFSBackups) Get(name string, options metav1.GetOptions) (result *v1.ZFSBackup, err error) { + result = &v1.ZFSBackup{} + err = c.client.Get(). + Namespace(c.ns). + Resource("zfsbackups"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ZFSBackups that match those selectors. +func (c *zFSBackups) List(opts metav1.ListOptions) (result *v1.ZFSBackupList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.ZFSBackupList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("zfsbackups"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested zFSBackups. +func (c *zFSBackups) Watch(opts metav1.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(). + Namespace(c.ns). + Resource("zfsbackups"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch() +} + +// Create takes the representation of a zFSBackup and creates it. Returns the server's representation of the zFSBackup, and an error, if there is any. +func (c *zFSBackups) Create(zFSBackup *v1.ZFSBackup) (result *v1.ZFSBackup, err error) { + result = &v1.ZFSBackup{} + err = c.client.Post(). + Namespace(c.ns). + Resource("zfsbackups"). + Body(zFSBackup). + Do(). + Into(result) + return +} + +// Update takes the representation of a zFSBackup and updates it. Returns the server's representation of the zFSBackup, and an error, if there is any. +func (c *zFSBackups) Update(zFSBackup *v1.ZFSBackup) (result *v1.ZFSBackup, err error) { + result = &v1.ZFSBackup{} + err = c.client.Put(). + Namespace(c.ns). + Resource("zfsbackups"). + Name(zFSBackup.Name). + Body(zFSBackup). + Do(). + 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 *zFSBackups) UpdateStatus(zFSBackup *v1.ZFSBackup) (result *v1.ZFSBackup, err error) { + result = &v1.ZFSBackup{} + err = c.client.Put(). + Namespace(c.ns). + Resource("zfsbackups"). + Name(zFSBackup.Name). + SubResource("status"). + Body(zFSBackup). + Do(). + Into(result) + return +} + +// Delete takes name of the zFSBackup and deletes it. Returns an error if one occurs. +func (c *zFSBackups) Delete(name string, options *metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("zfsbackups"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *zFSBackups) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error { + var timeout time.Duration + if listOptions.TimeoutSeconds != nil { + timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("zfsbackups"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Timeout(timeout). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched zFSBackup. +func (c *zFSBackups) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ZFSBackup, err error) { + result = &v1.ZFSBackup{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("zfsbackups"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/generated/clientset/internalclientset/typed/zfs/v1/zfsrestore.go b/pkg/generated/clientset/internalclientset/typed/zfs/v1/zfsrestore.go new file mode 100644 index 000000000..1df659367 --- /dev/null +++ b/pkg/generated/clientset/internalclientset/typed/zfs/v1/zfsrestore.go @@ -0,0 +1,191 @@ +/* +Copyright 2019 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +import ( + "time" + + v1 "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1" + scheme "github.com/openebs/zfs-localpv/pkg/generated/clientset/internalclientset/scheme" + metav1 "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" +) + +// ZFSRestoresGetter has a method to return a ZFSRestoreInterface. +// A group's client should implement this interface. +type ZFSRestoresGetter interface { + ZFSRestores(namespace string) ZFSRestoreInterface +} + +// ZFSRestoreInterface has methods to work with ZFSRestore resources. +type ZFSRestoreInterface interface { + Create(*v1.ZFSRestore) (*v1.ZFSRestore, error) + Update(*v1.ZFSRestore) (*v1.ZFSRestore, error) + UpdateStatus(*v1.ZFSRestore) (*v1.ZFSRestore, error) + Delete(name string, options *metav1.DeleteOptions) error + DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error + Get(name string, options metav1.GetOptions) (*v1.ZFSRestore, error) + List(opts metav1.ListOptions) (*v1.ZFSRestoreList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ZFSRestore, err error) + ZFSRestoreExpansion +} + +// zFSRestores implements ZFSRestoreInterface +type zFSRestores struct { + client rest.Interface + ns string +} + +// newZFSRestores returns a ZFSRestores +func newZFSRestores(c *ZfsV1Client, namespace string) *zFSRestores { + return &zFSRestores{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the zFSRestore, and returns the corresponding zFSRestore object, and an error if there is any. +func (c *zFSRestores) Get(name string, options metav1.GetOptions) (result *v1.ZFSRestore, err error) { + result = &v1.ZFSRestore{} + err = c.client.Get(). + Namespace(c.ns). + Resource("zfsrestores"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ZFSRestores that match those selectors. +func (c *zFSRestores) List(opts metav1.ListOptions) (result *v1.ZFSRestoreList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.ZFSRestoreList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("zfsrestores"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested zFSRestores. +func (c *zFSRestores) Watch(opts metav1.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(). + Namespace(c.ns). + Resource("zfsrestores"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch() +} + +// Create takes the representation of a zFSRestore and creates it. Returns the server's representation of the zFSRestore, and an error, if there is any. +func (c *zFSRestores) Create(zFSRestore *v1.ZFSRestore) (result *v1.ZFSRestore, err error) { + result = &v1.ZFSRestore{} + err = c.client.Post(). + Namespace(c.ns). + Resource("zfsrestores"). + Body(zFSRestore). + Do(). + Into(result) + return +} + +// Update takes the representation of a zFSRestore and updates it. Returns the server's representation of the zFSRestore, and an error, if there is any. +func (c *zFSRestores) Update(zFSRestore *v1.ZFSRestore) (result *v1.ZFSRestore, err error) { + result = &v1.ZFSRestore{} + err = c.client.Put(). + Namespace(c.ns). + Resource("zfsrestores"). + Name(zFSRestore.Name). + Body(zFSRestore). + Do(). + 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 *zFSRestores) UpdateStatus(zFSRestore *v1.ZFSRestore) (result *v1.ZFSRestore, err error) { + result = &v1.ZFSRestore{} + err = c.client.Put(). + Namespace(c.ns). + Resource("zfsrestores"). + Name(zFSRestore.Name). + SubResource("status"). + Body(zFSRestore). + Do(). + Into(result) + return +} + +// Delete takes name of the zFSRestore and deletes it. Returns an error if one occurs. +func (c *zFSRestores) Delete(name string, options *metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("zfsrestores"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *zFSRestores) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error { + var timeout time.Duration + if listOptions.TimeoutSeconds != nil { + timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("zfsrestores"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Timeout(timeout). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched zFSRestore. +func (c *zFSRestores) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ZFSRestore, err error) { + result = &v1.ZFSRestore{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("zfsrestores"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/generated/informer/externalversions/generic.go b/pkg/generated/informer/externalversions/generic.go index dae80baf2..5798a31fa 100644 --- a/pkg/generated/informer/externalversions/generic.go +++ b/pkg/generated/informer/externalversions/generic.go @@ -53,6 +53,10 @@ func (f *genericInformer) Lister() cache.GenericLister { func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { switch resource { // Group=zfs.openebs.io, Version=v1 + case v1.SchemeGroupVersion.WithResource("zfsbackups"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Zfs().V1().ZFSBackups().Informer()}, nil + case v1.SchemeGroupVersion.WithResource("zfsrestores"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Zfs().V1().ZFSRestores().Informer()}, nil case v1.SchemeGroupVersion.WithResource("zfssnapshots"): return &genericInformer{resource: resource.GroupResource(), informer: f.Zfs().V1().ZFSSnapshots().Informer()}, nil case v1.SchemeGroupVersion.WithResource("zfsvolumes"): diff --git a/pkg/generated/informer/externalversions/zfs/v1/interface.go b/pkg/generated/informer/externalversions/zfs/v1/interface.go index 8327982a6..e466bae8d 100644 --- a/pkg/generated/informer/externalversions/zfs/v1/interface.go +++ b/pkg/generated/informer/externalversions/zfs/v1/interface.go @@ -24,6 +24,10 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { + // ZFSBackups returns a ZFSBackupInformer. + ZFSBackups() ZFSBackupInformer + // ZFSRestores returns a ZFSRestoreInformer. + ZFSRestores() ZFSRestoreInformer // ZFSSnapshots returns a ZFSSnapshotInformer. ZFSSnapshots() ZFSSnapshotInformer // ZFSVolumes returns a ZFSVolumeInformer. @@ -41,6 +45,16 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } +// ZFSBackups returns a ZFSBackupInformer. +func (v *version) ZFSBackups() ZFSBackupInformer { + return &zFSBackupInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// ZFSRestores returns a ZFSRestoreInformer. +func (v *version) ZFSRestores() ZFSRestoreInformer { + return &zFSRestoreInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + // ZFSSnapshots returns a ZFSSnapshotInformer. func (v *version) ZFSSnapshots() ZFSSnapshotInformer { return &zFSSnapshotInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} diff --git a/pkg/generated/informer/externalversions/zfs/v1/zfsbackup.go b/pkg/generated/informer/externalversions/zfs/v1/zfsbackup.go new file mode 100644 index 000000000..b4b1e7f97 --- /dev/null +++ b/pkg/generated/informer/externalversions/zfs/v1/zfsbackup.go @@ -0,0 +1,89 @@ +/* +Copyright 2019 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + time "time" + + zfsv1 "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1" + internalclientset "github.com/openebs/zfs-localpv/pkg/generated/clientset/internalclientset" + internalinterfaces "github.com/openebs/zfs-localpv/pkg/generated/informer/externalversions/internalinterfaces" + v1 "github.com/openebs/zfs-localpv/pkg/generated/lister/zfs/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// ZFSBackupInformer provides access to a shared informer and lister for +// ZFSBackups. +type ZFSBackupInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ZFSBackupLister +} + +type zFSBackupInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewZFSBackupInformer constructs a new informer for ZFSBackup type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewZFSBackupInformer(client internalclientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredZFSBackupInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredZFSBackupInformer constructs a new informer for ZFSBackup type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredZFSBackupInformer(client internalclientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ZfsV1().ZFSBackups(namespace).List(options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ZfsV1().ZFSBackups(namespace).Watch(options) + }, + }, + &zfsv1.ZFSBackup{}, + resyncPeriod, + indexers, + ) +} + +func (f *zFSBackupInformer) defaultInformer(client internalclientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredZFSBackupInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *zFSBackupInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&zfsv1.ZFSBackup{}, f.defaultInformer) +} + +func (f *zFSBackupInformer) Lister() v1.ZFSBackupLister { + return v1.NewZFSBackupLister(f.Informer().GetIndexer()) +} diff --git a/pkg/generated/informer/externalversions/zfs/v1/zfsrestore.go b/pkg/generated/informer/externalversions/zfs/v1/zfsrestore.go new file mode 100644 index 000000000..6f8dacf5c --- /dev/null +++ b/pkg/generated/informer/externalversions/zfs/v1/zfsrestore.go @@ -0,0 +1,89 @@ +/* +Copyright 2019 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + time "time" + + zfsv1 "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1" + internalclientset "github.com/openebs/zfs-localpv/pkg/generated/clientset/internalclientset" + internalinterfaces "github.com/openebs/zfs-localpv/pkg/generated/informer/externalversions/internalinterfaces" + v1 "github.com/openebs/zfs-localpv/pkg/generated/lister/zfs/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// ZFSRestoreInformer provides access to a shared informer and lister for +// ZFSRestores. +type ZFSRestoreInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ZFSRestoreLister +} + +type zFSRestoreInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewZFSRestoreInformer constructs a new informer for ZFSRestore type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewZFSRestoreInformer(client internalclientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredZFSRestoreInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredZFSRestoreInformer constructs a new informer for ZFSRestore type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredZFSRestoreInformer(client internalclientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ZfsV1().ZFSRestores(namespace).List(options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ZfsV1().ZFSRestores(namespace).Watch(options) + }, + }, + &zfsv1.ZFSRestore{}, + resyncPeriod, + indexers, + ) +} + +func (f *zFSRestoreInformer) defaultInformer(client internalclientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredZFSRestoreInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *zFSRestoreInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&zfsv1.ZFSRestore{}, f.defaultInformer) +} + +func (f *zFSRestoreInformer) Lister() v1.ZFSRestoreLister { + return v1.NewZFSRestoreLister(f.Informer().GetIndexer()) +} diff --git a/pkg/generated/lister/zfs/v1/expansion_generated.go b/pkg/generated/lister/zfs/v1/expansion_generated.go index f8951ab9d..4842b2a5e 100644 --- a/pkg/generated/lister/zfs/v1/expansion_generated.go +++ b/pkg/generated/lister/zfs/v1/expansion_generated.go @@ -18,6 +18,22 @@ limitations under the License. package v1 +// ZFSBackupListerExpansion allows custom methods to be added to +// ZFSBackupLister. +type ZFSBackupListerExpansion interface{} + +// ZFSBackupNamespaceListerExpansion allows custom methods to be added to +// ZFSBackupNamespaceLister. +type ZFSBackupNamespaceListerExpansion interface{} + +// ZFSRestoreListerExpansion allows custom methods to be added to +// ZFSRestoreLister. +type ZFSRestoreListerExpansion interface{} + +// ZFSRestoreNamespaceListerExpansion allows custom methods to be added to +// ZFSRestoreNamespaceLister. +type ZFSRestoreNamespaceListerExpansion interface{} + // ZFSSnapshotListerExpansion allows custom methods to be added to // ZFSSnapshotLister. type ZFSSnapshotListerExpansion interface{} diff --git a/pkg/generated/lister/zfs/v1/zfsbackup.go b/pkg/generated/lister/zfs/v1/zfsbackup.go new file mode 100644 index 000000000..38f114ccb --- /dev/null +++ b/pkg/generated/lister/zfs/v1/zfsbackup.go @@ -0,0 +1,94 @@ +/* +Copyright 2019 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ZFSBackupLister helps list ZFSBackups. +type ZFSBackupLister interface { + // List lists all ZFSBackups in the indexer. + List(selector labels.Selector) (ret []*v1.ZFSBackup, err error) + // ZFSBackups returns an object that can list and get ZFSBackups. + ZFSBackups(namespace string) ZFSBackupNamespaceLister + ZFSBackupListerExpansion +} + +// zFSBackupLister implements the ZFSBackupLister interface. +type zFSBackupLister struct { + indexer cache.Indexer +} + +// NewZFSBackupLister returns a new ZFSBackupLister. +func NewZFSBackupLister(indexer cache.Indexer) ZFSBackupLister { + return &zFSBackupLister{indexer: indexer} +} + +// List lists all ZFSBackups in the indexer. +func (s *zFSBackupLister) List(selector labels.Selector) (ret []*v1.ZFSBackup, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ZFSBackup)) + }) + return ret, err +} + +// ZFSBackups returns an object that can list and get ZFSBackups. +func (s *zFSBackupLister) ZFSBackups(namespace string) ZFSBackupNamespaceLister { + return zFSBackupNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ZFSBackupNamespaceLister helps list and get ZFSBackups. +type ZFSBackupNamespaceLister interface { + // List lists all ZFSBackups in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1.ZFSBackup, err error) + // Get retrieves the ZFSBackup from the indexer for a given namespace and name. + Get(name string) (*v1.ZFSBackup, error) + ZFSBackupNamespaceListerExpansion +} + +// zFSBackupNamespaceLister implements the ZFSBackupNamespaceLister +// interface. +type zFSBackupNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all ZFSBackups in the indexer for a given namespace. +func (s zFSBackupNamespaceLister) List(selector labels.Selector) (ret []*v1.ZFSBackup, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ZFSBackup)) + }) + return ret, err +} + +// Get retrieves the ZFSBackup from the indexer for a given namespace and name. +func (s zFSBackupNamespaceLister) Get(name string) (*v1.ZFSBackup, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("zfsbackup"), name) + } + return obj.(*v1.ZFSBackup), nil +} diff --git a/pkg/generated/lister/zfs/v1/zfsrestore.go b/pkg/generated/lister/zfs/v1/zfsrestore.go new file mode 100644 index 000000000..ecf6fc0f9 --- /dev/null +++ b/pkg/generated/lister/zfs/v1/zfsrestore.go @@ -0,0 +1,94 @@ +/* +Copyright 2019 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ZFSRestoreLister helps list ZFSRestores. +type ZFSRestoreLister interface { + // List lists all ZFSRestores in the indexer. + List(selector labels.Selector) (ret []*v1.ZFSRestore, err error) + // ZFSRestores returns an object that can list and get ZFSRestores. + ZFSRestores(namespace string) ZFSRestoreNamespaceLister + ZFSRestoreListerExpansion +} + +// zFSRestoreLister implements the ZFSRestoreLister interface. +type zFSRestoreLister struct { + indexer cache.Indexer +} + +// NewZFSRestoreLister returns a new ZFSRestoreLister. +func NewZFSRestoreLister(indexer cache.Indexer) ZFSRestoreLister { + return &zFSRestoreLister{indexer: indexer} +} + +// List lists all ZFSRestores in the indexer. +func (s *zFSRestoreLister) List(selector labels.Selector) (ret []*v1.ZFSRestore, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ZFSRestore)) + }) + return ret, err +} + +// ZFSRestores returns an object that can list and get ZFSRestores. +func (s *zFSRestoreLister) ZFSRestores(namespace string) ZFSRestoreNamespaceLister { + return zFSRestoreNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ZFSRestoreNamespaceLister helps list and get ZFSRestores. +type ZFSRestoreNamespaceLister interface { + // List lists all ZFSRestores in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1.ZFSRestore, err error) + // Get retrieves the ZFSRestore from the indexer for a given namespace and name. + Get(name string) (*v1.ZFSRestore, error) + ZFSRestoreNamespaceListerExpansion +} + +// zFSRestoreNamespaceLister implements the ZFSRestoreNamespaceLister +// interface. +type zFSRestoreNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all ZFSRestores in the indexer for a given namespace. +func (s zFSRestoreNamespaceLister) List(selector labels.Selector) (ret []*v1.ZFSRestore, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ZFSRestore)) + }) + return ret, err +} + +// Get retrieves the ZFSRestore from the indexer for a given namespace and name. +func (s zFSRestoreNamespaceLister) Get(name string) (*v1.ZFSRestore, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("zfsrestore"), name) + } + return obj.(*v1.ZFSRestore), nil +}