|
| 1 | +/* |
| 2 | +Copyright 2016 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 testclient |
| 18 | + |
| 19 | +import ( |
| 20 | + "k8s.io/kubernetes/pkg/api" |
| 21 | + "k8s.io/kubernetes/pkg/apis/apps" |
| 22 | + "k8s.io/kubernetes/pkg/watch" |
| 23 | +) |
| 24 | + |
| 25 | +// FakePetSets implements PetSetsInterface. Meant to be embedded into a struct to get a default |
| 26 | +// implementation. This makes faking out just the method you want to test easier. |
| 27 | +type FakePetSets struct { |
| 28 | + Fake *FakeApps |
| 29 | + Namespace string |
| 30 | +} |
| 31 | + |
| 32 | +func (c *FakePetSets) Get(name string) (*apps.PetSet, error) { |
| 33 | + obj, err := c.Fake.Invokes(NewGetAction("petsets", c.Namespace, name), &apps.PetSet{}) |
| 34 | + if obj == nil { |
| 35 | + return nil, err |
| 36 | + } |
| 37 | + |
| 38 | + return obj.(*apps.PetSet), err |
| 39 | +} |
| 40 | + |
| 41 | +func (c *FakePetSets) List(opts api.ListOptions) (*apps.PetSetList, error) { |
| 42 | + obj, err := c.Fake.Invokes(NewListAction("petsets", c.Namespace, opts), &apps.PetSetList{}) |
| 43 | + if obj == nil { |
| 44 | + return nil, err |
| 45 | + } |
| 46 | + return obj.(*apps.PetSetList), err |
| 47 | +} |
| 48 | + |
| 49 | +func (c *FakePetSets) Create(rs *apps.PetSet) (*apps.PetSet, error) { |
| 50 | + obj, err := c.Fake.Invokes(NewCreateAction("petsets", c.Namespace, rs), rs) |
| 51 | + if obj == nil { |
| 52 | + return nil, err |
| 53 | + } |
| 54 | + |
| 55 | + return obj.(*apps.PetSet), err |
| 56 | +} |
| 57 | + |
| 58 | +func (c *FakePetSets) Update(rs *apps.PetSet) (*apps.PetSet, error) { |
| 59 | + obj, err := c.Fake.Invokes(NewUpdateAction("petsets", c.Namespace, rs), rs) |
| 60 | + if obj == nil { |
| 61 | + return nil, err |
| 62 | + } |
| 63 | + |
| 64 | + return obj.(*apps.PetSet), err |
| 65 | +} |
| 66 | + |
| 67 | +func (c *FakePetSets) Delete(name string, options *api.DeleteOptions) error { |
| 68 | + _, err := c.Fake.Invokes(NewDeleteAction("petsets", c.Namespace, name), &apps.PetSet{}) |
| 69 | + return err |
| 70 | +} |
| 71 | + |
| 72 | +func (c *FakePetSets) Watch(opts api.ListOptions) (watch.Interface, error) { |
| 73 | + return c.Fake.InvokesWatch(NewWatchAction("petsets", c.Namespace, opts)) |
| 74 | +} |
| 75 | + |
| 76 | +func (c *FakePetSets) UpdateStatus(rs *apps.PetSet) (result *apps.PetSet, err error) { |
| 77 | + obj, err := c.Fake.Invokes(NewUpdateSubresourceAction("petsets", "status", c.Namespace, rs), rs) |
| 78 | + if obj == nil { |
| 79 | + return nil, err |
| 80 | + } |
| 81 | + |
| 82 | + return obj.(*apps.PetSet), err |
| 83 | +} |
0 commit comments