-
Notifications
You must be signed in to change notification settings - Fork 4.7k
/
fake_rolebindings.go
59 lines (46 loc) · 2.06 KB
/
fake_rolebindings.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package testclient
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
clientgotesting "k8s.io/client-go/testing"
authorizationapi "github.com/openshift/origin/pkg/authorization/apis/authorization"
)
// FakeRoleBindings implements RoleBindingInterface. Meant to be embedded into a struct to get a default
// implementation. This makes faking out just the methods you want to test easier.
type FakeRoleBindings struct {
Fake *Fake
Namespace string
}
var roleBindingsResource = schema.GroupVersionResource{Group: "", Version: "", Resource: "rolebindings"}
func (c *FakeRoleBindings) Get(name string, options metav1.GetOptions) (*authorizationapi.RoleBinding, error) {
obj, err := c.Fake.Invokes(clientgotesting.NewGetAction(roleBindingsResource, c.Namespace, name), &authorizationapi.RoleBinding{})
if obj == nil {
return nil, err
}
return obj.(*authorizationapi.RoleBinding), err
}
func (c *FakeRoleBindings) List(opts metav1.ListOptions) (*authorizationapi.RoleBindingList, error) {
obj, err := c.Fake.Invokes(clientgotesting.NewListAction(roleBindingsResource, c.Namespace, opts), &authorizationapi.RoleBindingList{})
if obj == nil {
return nil, err
}
return obj.(*authorizationapi.RoleBindingList), err
}
func (c *FakeRoleBindings) Create(inObj *authorizationapi.RoleBinding) (*authorizationapi.RoleBinding, error) {
obj, err := c.Fake.Invokes(clientgotesting.NewCreateAction(roleBindingsResource, c.Namespace, inObj), inObj)
if obj == nil {
return nil, err
}
return obj.(*authorizationapi.RoleBinding), err
}
func (c *FakeRoleBindings) Update(inObj *authorizationapi.RoleBinding) (*authorizationapi.RoleBinding, error) {
obj, err := c.Fake.Invokes(clientgotesting.NewUpdateAction(roleBindingsResource, c.Namespace, inObj), inObj)
if obj == nil {
return nil, err
}
return obj.(*authorizationapi.RoleBinding), err
}
func (c *FakeRoleBindings) Delete(name string) error {
_, err := c.Fake.Invokes(clientgotesting.NewDeleteAction(roleBindingsResource, c.Namespace, name), &authorizationapi.RoleBinding{})
return err
}