forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 1
/
templateconfigs.go
38 lines (32 loc) · 1.11 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
38
package client
import (
configapi "github.com/openshift/origin/pkg/config/api"
templateapi "github.com/openshift/origin/pkg/template/api"
)
// TemplateConfigNamespacer has methods to work with Image resources in a namespace
type TemplateConfigsNamespacer interface {
TemplateConfigs(namespace string) TemplateConfigInterface
}
// TemplateConfigInterface exposes methods on Image resources.
type TemplateConfigInterface interface {
Create(t *templateapi.Template) (*configapi.Config, 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 return Config/List object with substituted
// parameters
func (c *templateConfigs) Create(in *templateapi.Template) (*configapi.Config, error) {
config := &configapi.Config{}
err := c.r.Post().Namespace(c.ns).Resource("templateConfigs").Body(in).Do().Into(config)
return config, err
}