Refactored BPA controller code for better testing
[icn.git] / cmd / bpa-operator / vendor / k8s.io / client-go / kubernetes / typed / core / v1 / fake / fake_persistentvolume.go
1 /*
2 Copyright 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 // Code generated by client-gen. DO NOT EDIT.
18
19 package fake
20
21 import (
22         corev1 "k8s.io/api/core/v1"
23         v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
24         labels "k8s.io/apimachinery/pkg/labels"
25         schema "k8s.io/apimachinery/pkg/runtime/schema"
26         types "k8s.io/apimachinery/pkg/types"
27         watch "k8s.io/apimachinery/pkg/watch"
28         testing "k8s.io/client-go/testing"
29 )
30
31 // FakePersistentVolumes implements PersistentVolumeInterface
32 type FakePersistentVolumes struct {
33         Fake *FakeCoreV1
34 }
35
36 var persistentvolumesResource = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "persistentvolumes"}
37
38 var persistentvolumesKind = schema.GroupVersionKind{Group: "", Version: "v1", Kind: "PersistentVolume"}
39
40 // Get takes name of the persistentVolume, and returns the corresponding persistentVolume object, and an error if there is any.
41 func (c *FakePersistentVolumes) Get(name string, options v1.GetOptions) (result *corev1.PersistentVolume, err error) {
42         obj, err := c.Fake.
43                 Invokes(testing.NewRootGetAction(persistentvolumesResource, name), &corev1.PersistentVolume{})
44         if obj == nil {
45                 return nil, err
46         }
47         return obj.(*corev1.PersistentVolume), err
48 }
49
50 // List takes label and field selectors, and returns the list of PersistentVolumes that match those selectors.
51 func (c *FakePersistentVolumes) List(opts v1.ListOptions) (result *corev1.PersistentVolumeList, err error) {
52         obj, err := c.Fake.
53                 Invokes(testing.NewRootListAction(persistentvolumesResource, persistentvolumesKind, opts), &corev1.PersistentVolumeList{})
54         if obj == nil {
55                 return nil, err
56         }
57
58         label, _, _ := testing.ExtractFromListOptions(opts)
59         if label == nil {
60                 label = labels.Everything()
61         }
62         list := &corev1.PersistentVolumeList{ListMeta: obj.(*corev1.PersistentVolumeList).ListMeta}
63         for _, item := range obj.(*corev1.PersistentVolumeList).Items {
64                 if label.Matches(labels.Set(item.Labels)) {
65                         list.Items = append(list.Items, item)
66                 }
67         }
68         return list, err
69 }
70
71 // Watch returns a watch.Interface that watches the requested persistentVolumes.
72 func (c *FakePersistentVolumes) Watch(opts v1.ListOptions) (watch.Interface, error) {
73         return c.Fake.
74                 InvokesWatch(testing.NewRootWatchAction(persistentvolumesResource, opts))
75 }
76
77 // Create takes the representation of a persistentVolume and creates it.  Returns the server's representation of the persistentVolume, and an error, if there is any.
78 func (c *FakePersistentVolumes) Create(persistentVolume *corev1.PersistentVolume) (result *corev1.PersistentVolume, err error) {
79         obj, err := c.Fake.
80                 Invokes(testing.NewRootCreateAction(persistentvolumesResource, persistentVolume), &corev1.PersistentVolume{})
81         if obj == nil {
82                 return nil, err
83         }
84         return obj.(*corev1.PersistentVolume), err
85 }
86
87 // Update takes the representation of a persistentVolume and updates it. Returns the server's representation of the persistentVolume, and an error, if there is any.
88 func (c *FakePersistentVolumes) Update(persistentVolume *corev1.PersistentVolume) (result *corev1.PersistentVolume, err error) {
89         obj, err := c.Fake.
90                 Invokes(testing.NewRootUpdateAction(persistentvolumesResource, persistentVolume), &corev1.PersistentVolume{})
91         if obj == nil {
92                 return nil, err
93         }
94         return obj.(*corev1.PersistentVolume), err
95 }
96
97 // UpdateStatus was generated because the type contains a Status member.
98 // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
99 func (c *FakePersistentVolumes) UpdateStatus(persistentVolume *corev1.PersistentVolume) (*corev1.PersistentVolume, error) {
100         obj, err := c.Fake.
101                 Invokes(testing.NewRootUpdateSubresourceAction(persistentvolumesResource, "status", persistentVolume), &corev1.PersistentVolume{})
102         if obj == nil {
103                 return nil, err
104         }
105         return obj.(*corev1.PersistentVolume), err
106 }
107
108 // Delete takes name of the persistentVolume and deletes it. Returns an error if one occurs.
109 func (c *FakePersistentVolumes) Delete(name string, options *v1.DeleteOptions) error {
110         _, err := c.Fake.
111                 Invokes(testing.NewRootDeleteAction(persistentvolumesResource, name), &corev1.PersistentVolume{})
112         return err
113 }
114
115 // DeleteCollection deletes a collection of objects.
116 func (c *FakePersistentVolumes) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
117         action := testing.NewRootDeleteCollectionAction(persistentvolumesResource, listOptions)
118
119         _, err := c.Fake.Invokes(action, &corev1.PersistentVolumeList{})
120         return err
121 }
122
123 // Patch applies the patch and returns the patched persistentVolume.
124 func (c *FakePersistentVolumes) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *corev1.PersistentVolume, err error) {
125         obj, err := c.Fake.
126                 Invokes(testing.NewRootPatchSubresourceAction(persistentvolumesResource, name, pt, data, subresources...), &corev1.PersistentVolume{})
127         if obj == nil {
128                 return nil, err
129         }
130         return obj.(*corev1.PersistentVolume), err
131 }