forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
registry.go
31 lines (25 loc) · 824 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 resourceaccessreview
import (
api "github.com/openshift/origin/pkg/authorization/api"
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/runtime"
)
type Registry interface {
CreateResourceAccessReview(ctx kapi.Context, resourceAccessReview *api.ResourceAccessReview) (*api.ResourceAccessReviewResponse, 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) CreateResourceAccessReview(ctx kapi.Context, resourceAccessReview *api.ResourceAccessReview) (*api.ResourceAccessReviewResponse, error) {
obj, err := s.Create(ctx, resourceAccessReview)
if err != nil {
return nil, err
}
return obj.(*api.ResourceAccessReviewResponse), nil
}