forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
clusterpolicybindings.go
77 lines (65 loc) · 3.12 KB
/
clusterpolicybindings.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package client
import (
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/watch"
authorizationapi "github.com/openshift/origin/pkg/authorization/api"
)
// ClusterPolicyBindingsInterface has methods to work with ClusterPolicyBindings resources in a namespace
type ClusterPolicyBindingsInterface interface {
ClusterPolicyBindings() ClusterPolicyBindingInterface
}
// ClusterPolicyBindingInterface exposes methods on ClusterPolicyBindings resources
type ClusterPolicyBindingInterface interface {
List(opts kapi.ListOptions) (*authorizationapi.ClusterPolicyBindingList, error)
Get(name string) (*authorizationapi.ClusterPolicyBinding, error)
Create(policyBinding *authorizationapi.ClusterPolicyBinding) (*authorizationapi.ClusterPolicyBinding, error)
Delete(name string) error
Watch(opts kapi.ListOptions) (watch.Interface, error)
}
type ClusterPolicyBindingsListerInterface interface {
ClusterPolicyBindings() ClusterPolicyBindingLister
}
type ClusterPolicyBindingLister interface {
List(options kapi.ListOptions) (*authorizationapi.ClusterPolicyBindingList, error)
Get(name string) (*authorizationapi.ClusterPolicyBinding, error)
}
type SyncedClusterPolicyBindingsListerInterface interface {
ClusterPolicyBindingsListerInterface
LastSyncResourceVersion() string
}
type clusterPolicyBindings struct {
r *Client
}
// newClusterPolicyBindings returns a clusterPolicyBindings
func newClusterPolicyBindings(c *Client) *clusterPolicyBindings {
return &clusterPolicyBindings{
r: c,
}
}
// List returns a list of clusterPolicyBindings that match the label and field selectors.
func (c *clusterPolicyBindings) List(opts kapi.ListOptions) (result *authorizationapi.ClusterPolicyBindingList, err error) {
result = &authorizationapi.ClusterPolicyBindingList{}
err = c.r.Get().Resource("clusterPolicyBindings").VersionedParams(&opts, kapi.ParameterCodec).Do().Into(result)
return
}
// Get returns information about a particular clusterPolicyBindings and error if one occurs.
func (c *clusterPolicyBindings) Get(name string) (result *authorizationapi.ClusterPolicyBinding, err error) {
result = &authorizationapi.ClusterPolicyBinding{}
err = c.r.Get().Resource("clusterPolicyBindings").Name(name).Do().Into(result)
return
}
// Create creates new policyBinding. Returns the server's representation of the clusterPolicyBindings and error if one occurs.
func (c *clusterPolicyBindings) Create(policyBinding *authorizationapi.ClusterPolicyBinding) (result *authorizationapi.ClusterPolicyBinding, err error) {
result = &authorizationapi.ClusterPolicyBinding{}
err = c.r.Post().Resource("clusterPolicyBindings").Body(policyBinding).Do().Into(result)
return
}
// Delete deletes a policyBinding, returns error if one occurs.
func (c *clusterPolicyBindings) Delete(name string) (err error) {
err = c.r.Delete().Resource("clusterPolicyBindings").Name(name).Do().Error()
return
}
// Watch returns a watch.Interface that watches the requested clusterPolicyBindings
func (c *clusterPolicyBindings) Watch(opts kapi.ListOptions) (watch.Interface, error) {
return c.r.Get().Prefix("watch").Resource("clusterPolicyBindings").VersionedParams(&opts, kapi.ParameterCodec).Watch()
}