forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
oauthclient.go
57 lines (46 loc) · 1.61 KB
/
oauthclient.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
package client
import (
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/watch"
oauthapi "github.com/openshift/origin/pkg/oauth/api"
)
type OAuthClientsInterface interface {
OAuthClients() OAuthClientInterface
}
type OAuthClientInterface interface {
Create(obj *oauthapi.OAuthClient) (*oauthapi.OAuthClient, error)
List(opts kapi.ListOptions) (*oauthapi.OAuthClientList, error)
Get(name string) (*oauthapi.OAuthClient, error)
Delete(name string) error
Watch(opts kapi.ListOptions) (watch.Interface, error)
}
type oauthClients struct {
r *Client
}
func newOAuthClients(c *Client) *oauthClients {
return &oauthClients{
r: c,
}
}
func (c *oauthClients) Create(obj *oauthapi.OAuthClient) (result *oauthapi.OAuthClient, err error) {
result = &oauthapi.OAuthClient{}
err = c.r.Post().Resource("oAuthClients").Body(obj).Do().Into(result)
return
}
func (c *oauthClients) List(opts kapi.ListOptions) (result *oauthapi.OAuthClientList, err error) {
result = &oauthapi.OAuthClientList{}
err = c.r.Get().Resource("oAuthClients").VersionedParams(&opts, kapi.ParameterCodec).Do().Into(result)
return
}
func (c *oauthClients) Get(name string) (result *oauthapi.OAuthClient, err error) {
result = &oauthapi.OAuthClient{}
err = c.r.Get().Resource("oAuthClients").Name(name).Do().Into(result)
return
}
func (c *oauthClients) Delete(name string) (err error) {
err = c.r.Delete().Resource("oAuthClients").Name(name).Do().Error()
return
}
func (c *oauthClients) Watch(opts kapi.ListOptions) (watch.Interface, error) {
return c.r.Get().Prefix("watch").Resource("oAuthClients").VersionedParams(&opts, kapi.ParameterCodec).Watch()
}