// UpdateList implements Versioner func (a APIObjectVersioner) UpdateList(obj runtime.Object, resourceVersion uint64) error { listMeta, err := metav1.ListMetaFor(obj) if err != nil || listMeta == nil { return err } versionString := "" if resourceVersion != 0 { versionString = strconv.FormatUint(resourceVersion, 10) } listMeta.ResourceVersion = versionString return nil }
// List returns a list object, with its resource version set. func (f *FakePVCControllerSource) List(options v1.ListOptions) (runtime.Object, error) { f.lock.RLock() defer f.lock.RUnlock() list, err := f.FakeControllerSource.getListItemsLocked() if err != nil { return nil, err } listObj := &v1.PersistentVolumeClaimList{} if err := meta.SetList(listObj, list); err != nil { return nil, err } objMeta, err := metav1.ListMetaFor(listObj) if err != nil { return nil, err } resourceVersion := len(f.changes) objMeta.ResourceVersion = strconv.Itoa(resourceVersion) return listObj, nil }