cephobjectstoreuser.go 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. Copyright The Kubernetes Authors.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. // Code generated by informer-gen. DO NOT EDIT.
  14. package v1
  15. import (
  16. "context"
  17. time "time"
  18. cephrookiov1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1"
  19. versioned "github.com/rook/rook/pkg/client/clientset/versioned"
  20. internalinterfaces "github.com/rook/rook/pkg/client/informers/externalversions/internalinterfaces"
  21. v1 "github.com/rook/rook/pkg/client/listers/ceph.rook.io/v1"
  22. metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
  23. runtime "k8s.io/apimachinery/pkg/runtime"
  24. watch "k8s.io/apimachinery/pkg/watch"
  25. cache "k8s.io/client-go/tools/cache"
  26. )
  27. // CephObjectStoreUserInformer provides access to a shared informer and lister for
  28. // CephObjectStoreUsers.
  29. type CephObjectStoreUserInformer interface {
  30. Informer() cache.SharedIndexInformer
  31. Lister() v1.CephObjectStoreUserLister
  32. }
  33. type cephObjectStoreUserInformer struct {
  34. factory internalinterfaces.SharedInformerFactory
  35. tweakListOptions internalinterfaces.TweakListOptionsFunc
  36. namespace string
  37. }
  38. // NewCephObjectStoreUserInformer constructs a new informer for CephObjectStoreUser type.
  39. // Always prefer using an informer factory to get a shared informer instead of getting an independent
  40. // one. This reduces memory footprint and number of connections to the server.
  41. func NewCephObjectStoreUserInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
  42. return NewFilteredCephObjectStoreUserInformer(client, namespace, resyncPeriod, indexers, nil)
  43. }
  44. // NewFilteredCephObjectStoreUserInformer constructs a new informer for CephObjectStoreUser type.
  45. // Always prefer using an informer factory to get a shared informer instead of getting an independent
  46. // one. This reduces memory footprint and number of connections to the server.
  47. func NewFilteredCephObjectStoreUserInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
  48. return cache.NewSharedIndexInformer(
  49. &cache.ListWatch{
  50. ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
  51. if tweakListOptions != nil {
  52. tweakListOptions(&options)
  53. }
  54. return client.CephV1().CephObjectStoreUsers(namespace).List(context.TODO(), options)
  55. },
  56. WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
  57. if tweakListOptions != nil {
  58. tweakListOptions(&options)
  59. }
  60. return client.CephV1().CephObjectStoreUsers(namespace).Watch(context.TODO(), options)
  61. },
  62. },
  63. &cephrookiov1.CephObjectStoreUser{},
  64. resyncPeriod,
  65. indexers,
  66. )
  67. }
  68. func (f *cephObjectStoreUserInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
  69. return NewFilteredCephObjectStoreUserInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
  70. }
  71. func (f *cephObjectStoreUserInformer) Informer() cache.SharedIndexInformer {
  72. return f.factory.InformerFor(&cephrookiov1.CephObjectStoreUser{}, f.defaultInformer)
  73. }
  74. func (f *cephObjectStoreUserInformer) Lister() v1.CephObjectStoreUserLister {
  75. return v1.NewCephObjectStoreUserLister(f.Informer().GetIndexer())
  76. }