Refactored BPA controller code for better testing
[icn.git] / cmd / bpa-operator / vendor / k8s.io / client-go / kubernetes / typed / core / v1 / fake / fake_podtemplate.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 // FakePodTemplates implements PodTemplateInterface
32 type FakePodTemplates struct {
33         Fake *FakeCoreV1
34         ns   string
35 }
36
37 var podtemplatesResource = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "podtemplates"}
38
39 var podtemplatesKind = schema.GroupVersionKind{Group: "", Version: "v1", Kind: "PodTemplate"}
40
41 // Get takes name of the podTemplate, and returns the corresponding podTemplate object, and an error if there is any.
42 func (c *FakePodTemplates) Get(name string, options v1.GetOptions) (result *corev1.PodTemplate, err error) {
43         obj, err := c.Fake.
44                 Invokes(testing.NewGetAction(podtemplatesResource, c.ns, name), &corev1.PodTemplate{})
45
46         if obj == nil {
47                 return nil, err
48         }
49         return obj.(*corev1.PodTemplate), err
50 }
51
52 // List takes label and field selectors, and returns the list of PodTemplates that match those selectors.
53 func (c *FakePodTemplates) List(opts v1.ListOptions) (result *corev1.PodTemplateList, err error) {
54         obj, err := c.Fake.
55                 Invokes(testing.NewListAction(podtemplatesResource, podtemplatesKind, c.ns, opts), &corev1.PodTemplateList{})
56
57         if obj == nil {
58                 return nil, err
59         }
60
61         label, _, _ := testing.ExtractFromListOptions(opts)
62         if label == nil {
63                 label = labels.Everything()
64         }
65         list := &corev1.PodTemplateList{ListMeta: obj.(*corev1.PodTemplateList).ListMeta}
66         for _, item := range obj.(*corev1.PodTemplateList).Items {
67                 if label.Matches(labels.Set(item.Labels)) {
68                         list.Items = append(list.Items, item)
69                 }
70         }
71         return list, err
72 }
73
74 // Watch returns a watch.Interface that watches the requested podTemplates.
75 func (c *FakePodTemplates) Watch(opts v1.ListOptions) (watch.Interface, error) {
76         return c.Fake.
77                 InvokesWatch(testing.NewWatchAction(podtemplatesResource, c.ns, opts))
78
79 }
80
81 // Create takes the representation of a podTemplate and creates it.  Returns the server's representation of the podTemplate, and an error, if there is any.
82 func (c *FakePodTemplates) Create(podTemplate *corev1.PodTemplate) (result *corev1.PodTemplate, err error) {
83         obj, err := c.Fake.
84                 Invokes(testing.NewCreateAction(podtemplatesResource, c.ns, podTemplate), &corev1.PodTemplate{})
85
86         if obj == nil {
87                 return nil, err
88         }
89         return obj.(*corev1.PodTemplate), err
90 }
91
92 // Update takes the representation of a podTemplate and updates it. Returns the server's representation of the podTemplate, and an error, if there is any.
93 func (c *FakePodTemplates) Update(podTemplate *corev1.PodTemplate) (result *corev1.PodTemplate, err error) {
94         obj, err := c.Fake.
95                 Invokes(testing.NewUpdateAction(podtemplatesResource, c.ns, podTemplate), &corev1.PodTemplate{})
96
97         if obj == nil {
98                 return nil, err
99         }
100         return obj.(*corev1.PodTemplate), err
101 }
102
103 // Delete takes name of the podTemplate and deletes it. Returns an error if one occurs.
104 func (c *FakePodTemplates) Delete(name string, options *v1.DeleteOptions) error {
105         _, err := c.Fake.
106                 Invokes(testing.NewDeleteAction(podtemplatesResource, c.ns, name), &corev1.PodTemplate{})
107
108         return err
109 }
110
111 // DeleteCollection deletes a collection of objects.
112 func (c *FakePodTemplates) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
113         action := testing.NewDeleteCollectionAction(podtemplatesResource, c.ns, listOptions)
114
115         _, err := c.Fake.Invokes(action, &corev1.PodTemplateList{})
116         return err
117 }
118
119 // Patch applies the patch and returns the patched podTemplate.
120 func (c *FakePodTemplates) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *corev1.PodTemplate, err error) {
121         obj, err := c.Fake.
122                 Invokes(testing.NewPatchSubresourceAction(podtemplatesResource, c.ns, name, pt, data, subresources...), &corev1.PodTemplate{})
123
124         if obj == nil {
125                 return nil, err
126         }
127         return obj.(*corev1.PodTemplate), err
128 }