forked from tliron/puccini
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgroup.go
38 lines (31 loc) · 964 Bytes
/
group.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 normal
//
// Group
//
type Group struct {
ServiceTemplate *ServiceTemplate `json:"-" yaml:"-"`
Name string `json:"-" yaml:"-"`
Metadata map[string]string `json:"metadata" yaml:"metadata"`
Description string `json:"description" yaml:"description"`
Types Types `json:"types" yaml:"types"`
Properties Constrainables `json:"properties" yaml:"properties"`
Interfaces Interfaces `json:"interfaces" yaml:"interfaces"`
Members []*NodeTemplate `json:"-" yaml:"-"`
}
func (self *ServiceTemplate) NewGroup(name string) *Group {
group := &Group{
ServiceTemplate: self,
Name: name,
Metadata: make(map[string]string),
Types: make(Types),
Properties: make(Constrainables),
Interfaces: make(Interfaces),
Members: make([]*NodeTemplate, 0),
}
self.Groups[name] = group
return group
}
//
// Groups
//
type Groups map[string]*Group