This repository was archived by the owner on Sep 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathtemplate.go
82 lines (69 loc) · 1.43 KB
/
template.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
package models
// Template represents a template that will be associated with a boot
// environment.
//
// swagger:model
type Template struct {
Validation
Access
Meta
Owned
Bundled
// ID is a unique identifier for this template. It cannot change once it is set.
//
// required: true
ID string `index:",key"`
// A description of this template
Description string
// Contents is the raw template. It must be a valid template
// according to text/template.
//
// required: true
Contents string
}
func (t *Template) GetMeta() Meta {
return t.Meta
}
func (t *Template) SetMeta(d Meta) {
t.Meta = d
}
func (t *Template) Validate() {
t.AddError(ValidNumberName("Invalid ID", t.ID))
}
func (t *Template) Prefix() string {
return "templates"
}
func (t *Template) Key() string {
return t.ID
}
func (t *Template) KeyName() string {
return "ID"
}
// GetDescription returns the object's Description
func (t *Template) GetDescription() string {
return t.Description
}
func (t *Template) Fill() {
t.Validation.fill(t)
if t.Meta == nil {
t.Meta = Meta{}
}
}
func (t *Template) AuthKey() string {
return t.Key()
}
func (b *Template) SliceOf() interface{} {
s := []*Template{}
return &s
}
func (b *Template) ToModels(obj interface{}) []Model {
items := obj.(*[]*Template)
res := make([]Model, len(*items))
for i, item := range *items {
res[i] = Model(item)
}
return res
}
func (b *Template) CanHaveActions() bool {
return true
}