forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
registry.go
31 lines (25 loc) · 878 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/apis/authorization"
"k8s.io/apimachinery/pkg/runtime"
apirequest "k8s.io/apiserver/pkg/endpoints/request"
)
type Registry interface {
CreateResourceAccessReview(ctx apirequest.Context, resourceAccessReview *api.ResourceAccessReview) (*api.ResourceAccessReviewResponse, error)
}
type Storage interface {
Create(ctx apirequest.Context, obj runtime.Object) (runtime.Object, error)
}
type storage struct {
Storage
}
func NewRegistry(s Storage) Registry {
return &storage{s}
}
func (s *storage) CreateResourceAccessReview(ctx apirequest.Context, resourceAccessReview *api.ResourceAccessReview) (*api.ResourceAccessReviewResponse, error) {
obj, err := s.Create(ctx, resourceAccessReview)
if err != nil {
return nil, err
}
return obj.(*api.ResourceAccessReviewResponse), nil
}