From 4608f192cec19adac0a94e5e205b96dfea2610ee Mon Sep 17 00:00:00 2001 From: travisn Date: Tue, 8 Jan 2019 11:48:31 -0700 Subject: [PATCH] nfs: generated code for the ceph nfs crd Co-authored-by: jtlayton Signed-off-by: travisn --- .../ceph.rook.io/v1/zz_generated.deepcopy.go | 112 +++++++++++++ .../ceph.rook.io/v1/ceph.rook.io_client.go | 5 + .../typed/ceph.rook.io/v1/cephnfs.go | 157 ++++++++++++++++++ .../v1/fake/fake_ceph.rook.io_client.go | 4 + .../ceph.rook.io/v1/fake/fake_cephnfs.go | 128 ++++++++++++++ .../ceph.rook.io/v1/generated_expansion.go | 2 + .../ceph.rook.io/v1/cephnfs.go | 89 ++++++++++ .../ceph.rook.io/v1/interface.go | 7 + .../informers/externalversions/generic.go | 2 + pkg/client/listers/ceph.rook.io/v1/cephnfs.go | 94 +++++++++++ .../ceph.rook.io/v1/expansion_generated.go | 8 + 11 files changed, 608 insertions(+) create mode 100644 pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephnfs.go create mode 100644 pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephnfs.go create mode 100644 pkg/client/informers/externalversions/ceph.rook.io/v1/cephnfs.go create mode 100644 pkg/client/listers/ceph.rook.io/v1/cephnfs.go diff --git a/pkg/apis/ceph.rook.io/v1/zz_generated.deepcopy.go b/pkg/apis/ceph.rook.io/v1/zz_generated.deepcopy.go index 32e93a783..9cc039d88 100644 --- a/pkg/apis/ceph.rook.io/v1/zz_generated.deepcopy.go +++ b/pkg/apis/ceph.rook.io/v1/zz_generated.deepcopy.go @@ -206,6 +206,66 @@ func (in *CephFilesystemList) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CephNFS) DeepCopyInto(out *CephNFS) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CephNFS. +func (in *CephNFS) DeepCopy() *CephNFS { + if in == nil { + return nil + } + out := new(CephNFS) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *CephNFS) 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 *CephNFSList) DeepCopyInto(out *CephNFSList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]CephNFS, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CephNFSList. +func (in *CephNFSList) DeepCopy() *CephNFSList { + if in == nil { + return nil + } + out := new(CephNFSList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *CephNFSList) 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 *CephObjectStore) DeepCopyInto(out *CephObjectStore) { *out = *in @@ -449,6 +509,40 @@ func (in *FilesystemSpec) DeepCopy() *FilesystemSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GaneshaRADOSSpec) DeepCopyInto(out *GaneshaRADOSSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GaneshaRADOSSpec. +func (in *GaneshaRADOSSpec) DeepCopy() *GaneshaRADOSSpec { + if in == nil { + return nil + } + out := new(GaneshaRADOSSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GaneshaServerSpec) DeepCopyInto(out *GaneshaServerSpec) { + *out = *in + in.Placement.DeepCopyInto(&out.Placement) + in.Resources.DeepCopyInto(&out.Resources) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GaneshaServerSpec. +func (in *GaneshaServerSpec) DeepCopy() *GaneshaServerSpec { + if in == nil { + return nil + } + out := new(GaneshaServerSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *GatewaySpec) DeepCopyInto(out *GatewaySpec) { *out = *in @@ -501,6 +595,24 @@ func (in *MonSpec) DeepCopy() *MonSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NFSGaneshaSpec) DeepCopyInto(out *NFSGaneshaSpec) { + *out = *in + out.RADOS = in.RADOS + in.Server.DeepCopyInto(&out.Server) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NFSGaneshaSpec. +func (in *NFSGaneshaSpec) DeepCopy() *NFSGaneshaSpec { + if in == nil { + return nil + } + out := new(NFSGaneshaSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ObjectStoreSpec) DeepCopyInto(out *ObjectStoreSpec) { *out = *in diff --git a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/ceph.rook.io_client.go b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/ceph.rook.io_client.go index 522f92003..29d3a360b 100644 --- a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/ceph.rook.io_client.go +++ b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/ceph.rook.io_client.go @@ -30,6 +30,7 @@ type CephV1Interface interface { CephBlockPoolsGetter CephClustersGetter CephFilesystemsGetter + CephNFSsGetter CephObjectStoresGetter CephObjectStoreUsersGetter } @@ -51,6 +52,10 @@ func (c *CephV1Client) CephFilesystems(namespace string) CephFilesystemInterface return newCephFilesystems(c, namespace) } +func (c *CephV1Client) CephNFSs(namespace string) CephNFSInterface { + return newCephNFSs(c, namespace) +} + func (c *CephV1Client) CephObjectStores(namespace string) CephObjectStoreInterface { return newCephObjectStores(c, namespace) } diff --git a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephnfs.go b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephnfs.go new file mode 100644 index 000000000..86b6c867d --- /dev/null +++ b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephnfs.go @@ -0,0 +1,157 @@ +/* +Copyright The Kubernetes 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 ( + v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" + scheme "github.com/rook/rook/pkg/client/clientset/versioned/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" +) + +// CephNFSsGetter has a method to return a CephNFSInterface. +// A group's client should implement this interface. +type CephNFSsGetter interface { + CephNFSs(namespace string) CephNFSInterface +} + +// CephNFSInterface has methods to work with CephNFS resources. +type CephNFSInterface interface { + Create(*v1.CephNFS) (*v1.CephNFS, error) + Update(*v1.CephNFS) (*v1.CephNFS, error) + Delete(name string, options *metav1.DeleteOptions) error + DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error + Get(name string, options metav1.GetOptions) (*v1.CephNFS, error) + List(opts metav1.ListOptions) (*v1.CephNFSList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.CephNFS, err error) + CephNFSExpansion +} + +// cephNFSs implements CephNFSInterface +type cephNFSs struct { + client rest.Interface + ns string +} + +// newCephNFSs returns a CephNFSs +func newCephNFSs(c *CephV1Client, namespace string) *cephNFSs { + return &cephNFSs{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the cephNFS, and returns the corresponding cephNFS object, and an error if there is any. +func (c *cephNFSs) Get(name string, options metav1.GetOptions) (result *v1.CephNFS, err error) { + result = &v1.CephNFS{} + err = c.client.Get(). + Namespace(c.ns). + Resource("cephnfss"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of CephNFSs that match those selectors. +func (c *cephNFSs) List(opts metav1.ListOptions) (result *v1.CephNFSList, err error) { + result = &v1.CephNFSList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("cephnfss"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested cephNFSs. +func (c *cephNFSs) Watch(opts metav1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("cephnfss"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a cephNFS and creates it. Returns the server's representation of the cephNFS, and an error, if there is any. +func (c *cephNFSs) Create(cephNFS *v1.CephNFS) (result *v1.CephNFS, err error) { + result = &v1.CephNFS{} + err = c.client.Post(). + Namespace(c.ns). + Resource("cephnfss"). + Body(cephNFS). + Do(). + Into(result) + return +} + +// Update takes the representation of a cephNFS and updates it. Returns the server's representation of the cephNFS, and an error, if there is any. +func (c *cephNFSs) Update(cephNFS *v1.CephNFS) (result *v1.CephNFS, err error) { + result = &v1.CephNFS{} + err = c.client.Put(). + Namespace(c.ns). + Resource("cephnfss"). + Name(cephNFS.Name). + Body(cephNFS). + Do(). + Into(result) + return +} + +// Delete takes name of the cephNFS and deletes it. Returns an error if one occurs. +func (c *cephNFSs) Delete(name string, options *metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("cephnfss"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *cephNFSs) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("cephnfss"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched cephNFS. +func (c *cephNFSs) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.CephNFS, err error) { + result = &v1.CephNFS{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("cephnfss"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_ceph.rook.io_client.go b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_ceph.rook.io_client.go index 349f55a71..44859bc77 100644 --- a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_ceph.rook.io_client.go +++ b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_ceph.rook.io_client.go @@ -40,6 +40,10 @@ func (c *FakeCephV1) CephFilesystems(namespace string) v1.CephFilesystemInterfac return &FakeCephFilesystems{c, namespace} } +func (c *FakeCephV1) CephNFSs(namespace string) v1.CephNFSInterface { + return &FakeCephNFSs{c, namespace} +} + func (c *FakeCephV1) CephObjectStores(namespace string) v1.CephObjectStoreInterface { return &FakeCephObjectStores{c, namespace} } diff --git a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephnfs.go b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephnfs.go new file mode 100644 index 000000000..aaef7b2cf --- /dev/null +++ b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephnfs.go @@ -0,0 +1,128 @@ +/* +Copyright The Kubernetes 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 ( + cephrookiov1 "github.com/rook/rook/pkg/apis/ceph.rook.io/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" +) + +// FakeCephNFSs implements CephNFSInterface +type FakeCephNFSs struct { + Fake *FakeCephV1 + ns string +} + +var cephnfssResource = schema.GroupVersionResource{Group: "ceph.rook.io", Version: "v1", Resource: "cephnfss"} + +var cephnfssKind = schema.GroupVersionKind{Group: "ceph.rook.io", Version: "v1", Kind: "CephNFS"} + +// Get takes name of the cephNFS, and returns the corresponding cephNFS object, and an error if there is any. +func (c *FakeCephNFSs) Get(name string, options v1.GetOptions) (result *cephrookiov1.CephNFS, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(cephnfssResource, c.ns, name), &cephrookiov1.CephNFS{}) + + if obj == nil { + return nil, err + } + return obj.(*cephrookiov1.CephNFS), err +} + +// List takes label and field selectors, and returns the list of CephNFSs that match those selectors. +func (c *FakeCephNFSs) List(opts v1.ListOptions) (result *cephrookiov1.CephNFSList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(cephnfssResource, cephnfssKind, c.ns, opts), &cephrookiov1.CephNFSList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &cephrookiov1.CephNFSList{ListMeta: obj.(*cephrookiov1.CephNFSList).ListMeta} + for _, item := range obj.(*cephrookiov1.CephNFSList).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 cephNFSs. +func (c *FakeCephNFSs) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(cephnfssResource, c.ns, opts)) + +} + +// Create takes the representation of a cephNFS and creates it. Returns the server's representation of the cephNFS, and an error, if there is any. +func (c *FakeCephNFSs) Create(cephNFS *cephrookiov1.CephNFS) (result *cephrookiov1.CephNFS, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(cephnfssResource, c.ns, cephNFS), &cephrookiov1.CephNFS{}) + + if obj == nil { + return nil, err + } + return obj.(*cephrookiov1.CephNFS), err +} + +// Update takes the representation of a cephNFS and updates it. Returns the server's representation of the cephNFS, and an error, if there is any. +func (c *FakeCephNFSs) Update(cephNFS *cephrookiov1.CephNFS) (result *cephrookiov1.CephNFS, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(cephnfssResource, c.ns, cephNFS), &cephrookiov1.CephNFS{}) + + if obj == nil { + return nil, err + } + return obj.(*cephrookiov1.CephNFS), err +} + +// Delete takes name of the cephNFS and deletes it. Returns an error if one occurs. +func (c *FakeCephNFSs) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(cephnfssResource, c.ns, name), &cephrookiov1.CephNFS{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeCephNFSs) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(cephnfssResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &cephrookiov1.CephNFSList{}) + return err +} + +// Patch applies the patch and returns the patched cephNFS. +func (c *FakeCephNFSs) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *cephrookiov1.CephNFS, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(cephnfssResource, c.ns, name, data, subresources...), &cephrookiov1.CephNFS{}) + + if obj == nil { + return nil, err + } + return obj.(*cephrookiov1.CephNFS), err +} diff --git a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/generated_expansion.go b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/generated_expansion.go index 52897c514..c29731ec9 100644 --- a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/generated_expansion.go +++ b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/generated_expansion.go @@ -24,6 +24,8 @@ type CephClusterExpansion interface{} type CephFilesystemExpansion interface{} +type CephNFSExpansion interface{} + type CephObjectStoreExpansion interface{} type CephObjectStoreUserExpansion interface{} diff --git a/pkg/client/informers/externalversions/ceph.rook.io/v1/cephnfs.go b/pkg/client/informers/externalversions/ceph.rook.io/v1/cephnfs.go new file mode 100644 index 000000000..305bfcf59 --- /dev/null +++ b/pkg/client/informers/externalversions/ceph.rook.io/v1/cephnfs.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes 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" + + cephrookiov1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" + versioned "github.com/rook/rook/pkg/client/clientset/versioned" + internalinterfaces "github.com/rook/rook/pkg/client/informers/externalversions/internalinterfaces" + v1 "github.com/rook/rook/pkg/client/listers/ceph.rook.io/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" +) + +// CephNFSInformer provides access to a shared informer and lister for +// CephNFSs. +type CephNFSInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.CephNFSLister +} + +type cephNFSInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewCephNFSInformer constructs a new informer for CephNFS 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 NewCephNFSInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredCephNFSInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredCephNFSInformer constructs a new informer for CephNFS 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 NewFilteredCephNFSInformer(client versioned.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.CephV1().CephNFSs(namespace).List(options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CephV1().CephNFSs(namespace).Watch(options) + }, + }, + &cephrookiov1.CephNFS{}, + resyncPeriod, + indexers, + ) +} + +func (f *cephNFSInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredCephNFSInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *cephNFSInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&cephrookiov1.CephNFS{}, f.defaultInformer) +} + +func (f *cephNFSInformer) Lister() v1.CephNFSLister { + return v1.NewCephNFSLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/ceph.rook.io/v1/interface.go b/pkg/client/informers/externalversions/ceph.rook.io/v1/interface.go index de6478935..cfb37e682 100644 --- a/pkg/client/informers/externalversions/ceph.rook.io/v1/interface.go +++ b/pkg/client/informers/externalversions/ceph.rook.io/v1/interface.go @@ -30,6 +30,8 @@ type Interface interface { CephClusters() CephClusterInformer // CephFilesystems returns a CephFilesystemInformer. CephFilesystems() CephFilesystemInformer + // CephNFSs returns a CephNFSInformer. + CephNFSs() CephNFSInformer // CephObjectStores returns a CephObjectStoreInformer. CephObjectStores() CephObjectStoreInformer // CephObjectStoreUsers returns a CephObjectStoreUserInformer. @@ -62,6 +64,11 @@ func (v *version) CephFilesystems() CephFilesystemInformer { return &cephFilesystemInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } +// CephNFSs returns a CephNFSInformer. +func (v *version) CephNFSs() CephNFSInformer { + return &cephNFSInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + // CephObjectStores returns a CephObjectStoreInformer. func (v *version) CephObjectStores() CephObjectStoreInformer { return &cephObjectStoreInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} diff --git a/pkg/client/informers/externalversions/generic.go b/pkg/client/informers/externalversions/generic.go index 245bd90f9..e2d4e7046 100644 --- a/pkg/client/informers/externalversions/generic.go +++ b/pkg/client/informers/externalversions/generic.go @@ -70,6 +70,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource return &genericInformer{resource: resource.GroupResource(), informer: f.Ceph().V1().CephClusters().Informer()}, nil case v1.SchemeGroupVersion.WithResource("cephfilesystems"): return &genericInformer{resource: resource.GroupResource(), informer: f.Ceph().V1().CephFilesystems().Informer()}, nil + case v1.SchemeGroupVersion.WithResource("cephnfss"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Ceph().V1().CephNFSs().Informer()}, nil case v1.SchemeGroupVersion.WithResource("cephobjectstores"): return &genericInformer{resource: resource.GroupResource(), informer: f.Ceph().V1().CephObjectStores().Informer()}, nil case v1.SchemeGroupVersion.WithResource("cephobjectstoreusers"): diff --git a/pkg/client/listers/ceph.rook.io/v1/cephnfs.go b/pkg/client/listers/ceph.rook.io/v1/cephnfs.go new file mode 100644 index 000000000..b8a42ac02 --- /dev/null +++ b/pkg/client/listers/ceph.rook.io/v1/cephnfs.go @@ -0,0 +1,94 @@ +/* +Copyright The Kubernetes 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/rook/rook/pkg/apis/ceph.rook.io/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// CephNFSLister helps list CephNFSs. +type CephNFSLister interface { + // List lists all CephNFSs in the indexer. + List(selector labels.Selector) (ret []*v1.CephNFS, err error) + // CephNFSs returns an object that can list and get CephNFSs. + CephNFSs(namespace string) CephNFSNamespaceLister + CephNFSListerExpansion +} + +// cephNFSLister implements the CephNFSLister interface. +type cephNFSLister struct { + indexer cache.Indexer +} + +// NewCephNFSLister returns a new CephNFSLister. +func NewCephNFSLister(indexer cache.Indexer) CephNFSLister { + return &cephNFSLister{indexer: indexer} +} + +// List lists all CephNFSs in the indexer. +func (s *cephNFSLister) List(selector labels.Selector) (ret []*v1.CephNFS, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.CephNFS)) + }) + return ret, err +} + +// CephNFSs returns an object that can list and get CephNFSs. +func (s *cephNFSLister) CephNFSs(namespace string) CephNFSNamespaceLister { + return cephNFSNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// CephNFSNamespaceLister helps list and get CephNFSs. +type CephNFSNamespaceLister interface { + // List lists all CephNFSs in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1.CephNFS, err error) + // Get retrieves the CephNFS from the indexer for a given namespace and name. + Get(name string) (*v1.CephNFS, error) + CephNFSNamespaceListerExpansion +} + +// cephNFSNamespaceLister implements the CephNFSNamespaceLister +// interface. +type cephNFSNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all CephNFSs in the indexer for a given namespace. +func (s cephNFSNamespaceLister) List(selector labels.Selector) (ret []*v1.CephNFS, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.CephNFS)) + }) + return ret, err +} + +// Get retrieves the CephNFS from the indexer for a given namespace and name. +func (s cephNFSNamespaceLister) Get(name string) (*v1.CephNFS, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("cephnfs"), name) + } + return obj.(*v1.CephNFS), nil +} diff --git a/pkg/client/listers/ceph.rook.io/v1/expansion_generated.go b/pkg/client/listers/ceph.rook.io/v1/expansion_generated.go index 80c1b4770..62f162544 100644 --- a/pkg/client/listers/ceph.rook.io/v1/expansion_generated.go +++ b/pkg/client/listers/ceph.rook.io/v1/expansion_generated.go @@ -42,6 +42,14 @@ type CephFilesystemListerExpansion interface{} // CephFilesystemNamespaceLister. type CephFilesystemNamespaceListerExpansion interface{} +// CephNFSListerExpansion allows custom methods to be added to +// CephNFSLister. +type CephNFSListerExpansion interface{} + +// CephNFSNamespaceListerExpansion allows custom methods to be added to +// CephNFSNamespaceLister. +type CephNFSNamespaceListerExpansion interface{} + // CephObjectStoreListerExpansion allows custom methods to be added to // CephObjectStoreLister. type CephObjectStoreListerExpansion interface{}