forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
subjectaccessreview.go
55 lines (46 loc) · 2 KB
/
subjectaccessreview.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
package client
import (
authorizationapi "github.com/openshift/origin/pkg/authorization/api"
)
// SubjectAccessReviewsNamespacer has methods to work with SubjectAccessReview resources in a namespace
type SubjectAccessReviewsNamespacer interface {
SubjectAccessReviews(namespace string) SubjectAccessReviewInterface
}
// SubjectAccessReviewInterface exposes methods on SubjectAccessReview resources.
type SubjectAccessReviewInterface interface {
Create(policy *authorizationapi.SubjectAccessReview) (*authorizationapi.SubjectAccessReviewResponse, error)
}
// subjectAccessReviews implements SubjectAccessReviewsNamespacer interface
type subjectAccessReviews struct {
r *Client
ns string
}
// newSubjectAccessReviews returns a subjectAccessReviews
func newSubjectAccessReviews(c *Client, namespace string) *subjectAccessReviews {
return &subjectAccessReviews{
r: c,
ns: namespace,
}
}
// Create creates new policy. Returns the server's representation of the policy and error if one occurs.
func (c *subjectAccessReviews) Create(policy *authorizationapi.SubjectAccessReview) (result *authorizationapi.SubjectAccessReviewResponse, err error) {
result = &authorizationapi.SubjectAccessReviewResponse{}
err = c.r.Post().Namespace(c.ns).Resource("subjectAccessReviews").Body(policy).Do().Into(result)
return
}
// rootSubjectAccessReviews implements RootSubjectAccessReviews interface
type rootSubjectAccessReviews struct {
r *Client
}
// newRootSubjectAccessReviews returns a rootSubjectAccessReviews
func newRootSubjectAccessReviews(c *Client) *rootSubjectAccessReviews {
return &rootSubjectAccessReviews{
r: c,
}
}
// Create creates new policy. Returns the server's representation of the policy and error if one occurs.
func (c *rootSubjectAccessReviews) Create(policy *authorizationapi.SubjectAccessReview) (result *authorizationapi.SubjectAccessReviewResponse, err error) {
result = &authorizationapi.SubjectAccessReviewResponse{}
err = c.r.Post().Resource("subjectAccessReviews").Body(policy).Do().Into(result)
return
}