forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 1
/
server.go
39 lines (34 loc) · 1.24 KB
/
server.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
package server
import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/apiserver"
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
"github.com/GoogleCloudPlatform/kubernetes/pkg/tools"
"github.com/openshift/origin/pkg/oauth/registry/accesstoken"
"github.com/openshift/origin/pkg/oauth/registry/authorizetoken"
"github.com/openshift/origin/pkg/oauth/registry/client"
"github.com/openshift/origin/pkg/oauth/registry/clientauthorization"
"github.com/openshift/origin/pkg/oauth/registry/etcd"
)
type Server struct {
storage map[string]apiserver.RESTStorage
}
func NewServer(helper tools.EtcdHelper) *Server {
registry := etcd.New(helper)
s := &Server{
storage: map[string]apiserver.RESTStorage{
"accessTokens": accesstoken.NewREST(registry),
"authorizeTokens": authorizetoken.NewREST(registry),
"clients": client.NewREST(registry),
"clientAuthorizations": clientauthorization.NewREST(registry),
},
}
return s
}
// API_v1beta1 returns the resources and codec for API version v1beta1.
func (s *Server) API_v1beta1() (map[string]apiserver.RESTStorage, runtime.Codec) {
storage := make(map[string]apiserver.RESTStorage)
for k, v := range s.storage {
storage[k] = v
}
return storage, runtime.DefaultCodec
}