forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 1
/
rest.go
27 lines (21 loc) · 765 Bytes
/
rest.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
package generator
import (
"k8s.io/apimachinery/pkg/runtime"
apirequest "k8s.io/apiserver/pkg/endpoints/request"
deployapi "github.com/openshift/origin/pkg/deploy/apis/apps"
)
// REST is a RESTStorage implementation for a DeploymentConfigGenerator which supports only
// the Get operation (as the generator has no underlying storage object).
type REST struct {
generator *DeploymentConfigGenerator
codec runtime.Codec
}
func NewREST(generator *DeploymentConfigGenerator, codec runtime.Codec) *REST {
return &REST{generator: generator, codec: codec}
}
func (s *REST) New() runtime.Object {
return &deployapi.DeploymentConfig{}
}
func (s *REST) Get(ctx apirequest.Context, id string) (runtime.Object, error) {
return s.generator.Generate(ctx, id)
}