forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
registry.go
31 lines (25 loc) · 813 Bytes
/
registry.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
package subjectaccessreview
import (
api "github.com/openshift/origin/pkg/authorization/api"
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/runtime"
)
type Registry interface {
CreateSubjectAccessReview(ctx kapi.Context, subjectAccessReview *api.SubjectAccessReview) (*api.SubjectAccessReviewResponse, error)
}
type Storage interface {
Create(ctx kapi.Context, obj runtime.Object) (runtime.Object, error)
}
type storage struct {
Storage
}
func NewRegistry(s Storage) Registry {
return &storage{s}
}
func (s *storage) CreateSubjectAccessReview(ctx kapi.Context, subjectAccessReview *api.SubjectAccessReview) (*api.SubjectAccessReviewResponse, error) {
obj, err := s.Create(ctx, subjectAccessReview)
if err != nil {
return nil, err
}
return obj.(*api.SubjectAccessReviewResponse), nil
}