Refactored BPA controller code for better testing
[icn.git] / cmd / bpa-operator / vendor / k8s.io / client-go / kubernetes / typed / core / v1 / fake / fake_pod_expansion.go
1 /*
2 Copyright 2014 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 package fake
18
19 import (
20         "k8s.io/api/core/v1"
21         policy "k8s.io/api/policy/v1beta1"
22         restclient "k8s.io/client-go/rest"
23         core "k8s.io/client-go/testing"
24 )
25
26 func (c *FakePods) Bind(binding *v1.Binding) error {
27         action := core.CreateActionImpl{}
28         action.Verb = "create"
29         action.Namespace = binding.Namespace
30         action.Resource = podsResource
31         action.Subresource = "binding"
32         action.Object = binding
33
34         _, err := c.Fake.Invokes(action, binding)
35         return err
36 }
37
38 func (c *FakePods) GetBinding(name string) (result *v1.Binding, err error) {
39         obj, err := c.Fake.
40                 Invokes(core.NewGetSubresourceAction(podsResource, c.ns, "binding", name), &v1.Binding{})
41
42         if obj == nil {
43                 return nil, err
44         }
45         return obj.(*v1.Binding), err
46 }
47
48 func (c *FakePods) GetLogs(name string, opts *v1.PodLogOptions) *restclient.Request {
49         action := core.GenericActionImpl{}
50         action.Verb = "get"
51         action.Namespace = c.ns
52         action.Resource = podsResource
53         action.Subresource = "log"
54         action.Value = opts
55
56         _, _ = c.Fake.Invokes(action, &v1.Pod{})
57         return &restclient.Request{}
58 }
59
60 func (c *FakePods) Evict(eviction *policy.Eviction) error {
61         action := core.CreateActionImpl{}
62         action.Verb = "create"
63         action.Resource = podsResource
64         action.Subresource = "eviction"
65         action.Object = eviction
66
67         _, err := c.Fake.Invokes(action, eviction)
68         return err
69 }