forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
templateconfigs.go
37 lines (31 loc) · 1.08 KB
/
templateconfigs.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
package client
import (
templateapi "github.com/openshift/origin/pkg/template/api"
)
// TemplateConfigNamespacer has methods to work with Image resources in a namespace
// TODO: Rename to ProcessedTemplates
type TemplateConfigsNamespacer interface {
TemplateConfigs(namespace string) TemplateConfigInterface
}
// TemplateConfigInterface exposes methods on Image resources.
type TemplateConfigInterface interface {
Create(t *templateapi.Template) (*templateapi.Template, error)
}
// templateConfigs implements TemplateConfigsNamespacer interface
type templateConfigs struct {
r *Client
ns string
}
// newTemplateConfigs returns an TemplateConfigInterface
func newTemplateConfigs(c *Client, namespace string) TemplateConfigInterface {
return &templateConfigs{
r: c,
ns: namespace,
}
}
// Create process the Template and returns its current state
func (c *templateConfigs) Create(in *templateapi.Template) (*templateapi.Template, error) {
template := &templateapi.Template{}
err := c.r.Post().Namespace(c.ns).Resource("processedTemplates").Body(in).Do().Into(template)
return template, err
}