forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoauthaccesstoken.go
46 lines (38 loc) · 1.45 KB
/
oauthaccesstoken.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
package client
import (
oauthapi "github.com/openshift/origin/pkg/oauth/api"
)
// OAuthAccessTokensInterface has methods to work with OAuthAccessTokens resources in a namespace
type OAuthAccessTokensInterface interface {
OAuthAccessTokens() OAuthAccessTokenInterface
}
// OAuthAccessTokenInterface exposes methods on OAuthAccessTokens resources.
type OAuthAccessTokenInterface interface {
Create(token *oauthapi.OAuthAccessToken) (*oauthapi.OAuthAccessToken, error)
Get(name string) (*oauthapi.OAuthAccessToken, error)
Delete(name string) error
}
type oauthAccessTokenInterface struct {
r *Client
}
func newOAuthAccessTokens(c *Client) *oauthAccessTokenInterface {
return &oauthAccessTokenInterface{
r: c,
}
}
// Get returns information about a particular image and error if one occurs.
func (c *oauthAccessTokenInterface) Get(name string) (result *oauthapi.OAuthAccessToken, err error) {
result = &oauthapi.OAuthAccessToken{}
err = c.r.Get().Resource("oAuthAccessTokens").Name(name).Do().Into(result)
return
}
// Delete removes the OAuthAccessToken on server
func (c *oauthAccessTokenInterface) Delete(name string) (err error) {
err = c.r.Delete().Resource("oAuthAccessTokens").Name(name).Do().Error()
return
}
func (c *oauthAccessTokenInterface) Create(token *oauthapi.OAuthAccessToken) (result *oauthapi.OAuthAccessToken, err error) {
result = &oauthapi.OAuthAccessToken{}
err = c.r.Post().Resource("oAuthAccessTokens").Body(token).Do().Into(result)
return
}