|
| 1 | +/* |
| 2 | +Copyright 2017 The Kubernetes Authors. |
| 3 | +
|
| 4 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +you may not use this file except in compliance with the License. |
| 6 | +You may obtain a copy of the License at |
| 7 | +
|
| 8 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +
|
| 10 | +Unless required by applicable law or agreed to in writing, software |
| 11 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +See the License for the specific language governing permissions and |
| 14 | +limitations under the License. |
| 15 | +*/ |
| 16 | + |
| 17 | +// This file was automatically generated by informer-gen |
| 18 | + |
| 19 | +package v1alpha1 |
| 20 | + |
| 21 | +import ( |
| 22 | + storage_v1alpha1 "k8s.io/api/storage/v1alpha1" |
| 23 | + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
| 24 | + runtime "k8s.io/apimachinery/pkg/runtime" |
| 25 | + watch "k8s.io/apimachinery/pkg/watch" |
| 26 | + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" |
| 27 | + kubernetes "k8s.io/client-go/kubernetes" |
| 28 | + v1alpha1 "k8s.io/client-go/listers/storage/v1alpha1" |
| 29 | + cache "k8s.io/client-go/tools/cache" |
| 30 | + time "time" |
| 31 | +) |
| 32 | + |
| 33 | +// VolumeAttachmentInformer provides access to a shared informer and lister for |
| 34 | +// VolumeAttachments. |
| 35 | +type VolumeAttachmentInformer interface { |
| 36 | + Informer() cache.SharedIndexInformer |
| 37 | + Lister() v1alpha1.VolumeAttachmentLister |
| 38 | +} |
| 39 | + |
| 40 | +type volumeAttachmentInformer struct { |
| 41 | + factory internalinterfaces.SharedInformerFactory |
| 42 | + tweakListOptions internalinterfaces.TweakListOptionsFunc |
| 43 | +} |
| 44 | + |
| 45 | +// NewVolumeAttachmentInformer constructs a new informer for VolumeAttachment type. |
| 46 | +// Always prefer using an informer factory to get a shared informer instead of getting an independent |
| 47 | +// one. This reduces memory footprint and number of connections to the server. |
| 48 | +func NewVolumeAttachmentInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { |
| 49 | + return NewFilteredVolumeAttachmentInformer(client, resyncPeriod, indexers, nil) |
| 50 | +} |
| 51 | + |
| 52 | +// NewFilteredVolumeAttachmentInformer constructs a new informer for VolumeAttachment type. |
| 53 | +// Always prefer using an informer factory to get a shared informer instead of getting an independent |
| 54 | +// one. This reduces memory footprint and number of connections to the server. |
| 55 | +func NewFilteredVolumeAttachmentInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { |
| 56 | + return cache.NewSharedIndexInformer( |
| 57 | + &cache.ListWatch{ |
| 58 | + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { |
| 59 | + if tweakListOptions != nil { |
| 60 | + tweakListOptions(&options) |
| 61 | + } |
| 62 | + return client.StorageV1alpha1().VolumeAttachments().List(options) |
| 63 | + }, |
| 64 | + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { |
| 65 | + if tweakListOptions != nil { |
| 66 | + tweakListOptions(&options) |
| 67 | + } |
| 68 | + return client.StorageV1alpha1().VolumeAttachments().Watch(options) |
| 69 | + }, |
| 70 | + }, |
| 71 | + &storage_v1alpha1.VolumeAttachment{}, |
| 72 | + resyncPeriod, |
| 73 | + indexers, |
| 74 | + ) |
| 75 | +} |
| 76 | + |
| 77 | +func (f *volumeAttachmentInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { |
| 78 | + return NewFilteredVolumeAttachmentInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) |
| 79 | +} |
| 80 | + |
| 81 | +func (f *volumeAttachmentInformer) Informer() cache.SharedIndexInformer { |
| 82 | + return f.factory.InformerFor(&storage_v1alpha1.VolumeAttachment{}, f.defaultInformer) |
| 83 | +} |
| 84 | + |
| 85 | +func (f *volumeAttachmentInformer) Lister() v1alpha1.VolumeAttachmentLister { |
| 86 | + return v1alpha1.NewVolumeAttachmentLister(f.Informer().GetIndexer()) |
| 87 | +} |
0 commit comments