2015-03-26 19:50:36 +00:00
|
|
|
/*
|
2015-05-01 16:19:44 +00:00
|
|
|
Copyright 2014 The Kubernetes Authors All rights reserved.
|
2015-03-26 19:50:36 +00:00
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2015-04-06 23:27:53 +00:00
|
|
|
package testclient
|
2015-03-26 19:50:36 +00:00
|
|
|
|
|
|
|
import (
|
2015-08-05 22:03:47 +00:00
|
|
|
"k8s.io/kubernetes/pkg/api"
|
2015-11-17 09:59:13 +00:00
|
|
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
2015-08-05 22:03:47 +00:00
|
|
|
"k8s.io/kubernetes/pkg/watch"
|
2015-03-26 19:50:36 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type FakePersistentVolumes struct {
|
2015-08-03 13:21:11 +00:00
|
|
|
Fake *Fake
|
2015-03-26 19:50:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (c *FakePersistentVolumes) Get(name string) (*api.PersistentVolume, error) {
|
2015-08-03 13:21:11 +00:00
|
|
|
obj, err := c.Fake.Invokes(NewRootGetAction("persistentvolumes", name), &api.PersistentVolume{})
|
|
|
|
if obj == nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
2015-04-06 23:27:53 +00:00
|
|
|
return obj.(*api.PersistentVolume), err
|
2015-03-26 19:50:36 +00:00
|
|
|
}
|
|
|
|
|
2015-12-02 11:12:57 +00:00
|
|
|
func (c *FakePersistentVolumes) List(opts unversioned.ListOptions) (*api.PersistentVolumeList, error) {
|
|
|
|
obj, err := c.Fake.Invokes(NewRootListAction("persistentvolumes", opts), &api.PersistentVolumeList{})
|
2015-08-03 13:21:11 +00:00
|
|
|
if obj == nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return obj.(*api.PersistentVolumeList), err
|
2015-03-26 19:50:36 +00:00
|
|
|
}
|
|
|
|
|
2015-04-09 16:02:06 +00:00
|
|
|
func (c *FakePersistentVolumes) Create(pv *api.PersistentVolume) (*api.PersistentVolume, error) {
|
2015-08-03 13:21:11 +00:00
|
|
|
obj, err := c.Fake.Invokes(NewRootCreateAction("persistentvolumes", pv), pv)
|
|
|
|
if obj == nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
2015-04-06 23:27:53 +00:00
|
|
|
return obj.(*api.PersistentVolume), err
|
2015-03-26 19:50:36 +00:00
|
|
|
}
|
|
|
|
|
2015-04-09 16:02:06 +00:00
|
|
|
func (c *FakePersistentVolumes) Update(pv *api.PersistentVolume) (*api.PersistentVolume, error) {
|
2015-08-03 13:21:11 +00:00
|
|
|
obj, err := c.Fake.Invokes(NewRootUpdateAction("persistentvolumes", pv), pv)
|
|
|
|
if obj == nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
2015-04-09 16:02:06 +00:00
|
|
|
return obj.(*api.PersistentVolume), err
|
|
|
|
}
|
|
|
|
|
2015-08-03 13:21:11 +00:00
|
|
|
func (c *FakePersistentVolumes) Delete(name string) error {
|
|
|
|
_, err := c.Fake.Invokes(NewRootDeleteAction("persistentvolumes", name), &api.PersistentVolume{})
|
|
|
|
return err
|
2015-03-26 19:50:36 +00:00
|
|
|
}
|
|
|
|
|
2015-11-26 15:27:45 +00:00
|
|
|
func (c *FakePersistentVolumes) Watch(opts unversioned.ListOptions) (watch.Interface, error) {
|
|
|
|
return c.Fake.InvokesWatch(NewRootWatchAction("persistentvolumes", opts))
|
2015-03-26 19:50:36 +00:00
|
|
|
}
|
2015-08-03 13:21:11 +00:00
|
|
|
|
|
|
|
func (c *FakePersistentVolumes) UpdateStatus(pv *api.PersistentVolume) (*api.PersistentVolume, error) {
|
|
|
|
action := UpdateActionImpl{}
|
|
|
|
action.Verb = "update"
|
|
|
|
action.Resource = "persistentvolumes"
|
|
|
|
action.Subresource = "status"
|
|
|
|
action.Object = pv
|
|
|
|
|
|
|
|
obj, err := c.Fake.Invokes(action, pv)
|
|
|
|
if obj == nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return obj.(*api.PersistentVolume), err
|
|
|
|
}
|