-
Notifications
You must be signed in to change notification settings - Fork 3
/
types.go
158 lines (129 loc) · 4.29 KB
/
types.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
package manifest
import "fmt"
type Git struct {
Remote string
Ref string `yaml:",omitempty"`
SubDir string `yaml:"subDir,omitempty"`
LocalDir string `yaml:"localDir,omitempty"`
}
type SourceLocation struct {
Dir string `yaml:",omitempty"`
S3 string `yaml:",omitempty"`
Git Git `yaml:",omitempty"`
}
type Metadata struct {
Name string
Origin string `yaml:",omitempty"`
Kind string `yaml:",omitempty"`
Title string `yaml:",omitempty"`
Brief string `yaml:",omitempty"`
Description string `yaml:",omitempty"`
Version string `yaml:",omitempty"`
Maturity string `yaml:",omitempty"`
License string `yaml:",omitempty"`
Icon string `yaml:",omitempty"`
Source SourceLocation `yaml:",omitempty"`
FromStack string `yaml:"fromStack,omitempty"`
Annotations map[string]string `yaml:",omitempty"`
}
type PlatformMetadata struct {
Provides []string `yaml:",omitempty"`
}
type ComponentRef struct {
Name string
Source SourceLocation `yaml:",omitempty"`
Depends []string `yaml:",omitempty"`
Annotations map[string]string `yaml:",omitempty"`
}
type RequiresTuning struct {
Optional []string `yaml:",omitempty"`
}
type ReadyCondition struct {
DNS string `yaml:"dns,omitempty"`
URL string `yaml:"url,omitempty"`
WaitSeconds int `yaml:"waitSeconds,omitempty"`
PauseSeconds int `yaml:"pauseSeconds,omitempty"`
}
type LifecycleOptions struct {
Random *struct {
Bytes int `yaml:",omitempty"`
} `yaml:",omitempty"`
}
type Lifecycle struct {
Bare string `yaml:",omitempty"`
Verbs []string `yaml:",omitempty"`
Order []string `yaml:",omitempty"`
Mandatory []string `yaml:",omitempty"`
Optional []string `yaml:",omitempty"`
Requires RequiresTuning `yaml:",omitempty"` // TODO use pointer?
ReadyConditions []ReadyCondition `yaml:"readyConditions,omitempty"`
Options *LifecycleOptions `yaml:",omitempty"`
}
type Output struct {
Name string
Brief string `yaml:",omitempty"`
Description string `yaml:",omitempty"`
Value interface{} `yaml:",omitempty"`
FromTfVar string `yaml:"fromTfVar,omitempty"`
Kind string `yaml:",omitempty"`
}
type Parameter struct {
Name string
Component string `yaml:",omitempty"` // target specific component instance
Kind string `yaml:",omitempty"`
Brief string `yaml:",omitempty"`
Description string `yaml:",omitempty"`
Default interface{} `yaml:",omitempty"`
Value interface{} `yaml:",omitempty"`
Empty string `yaml:",omitempty"` // "allow"
FromEnv string `yaml:"fromEnv,omitempty"`
FromFile string `yaml:"fromFile,omitempty"`
Env string `yaml:",omitempty"`
Parameters []Parameter `yaml:",omitempty"`
}
type TemplateTarget struct {
Kind string `yaml:",omitempty"`
Directories []string `yaml:",omitempty"`
Files []string `yaml:",omitempty"`
}
type TemplateSetup struct {
Kind string `yaml:",omitempty"`
Directories []string `yaml:",omitempty"`
Files []string `yaml:",omitempty"`
Extra []TemplateTarget `yaml:",omitempty"`
}
type Manifest struct {
Version int
Kind string
Meta Metadata
Components []ComponentRef `yaml:",omitempty"`
Requires []string `yaml:",omitempty"`
Provides []string `yaml:",omitempty"`
Platform PlatformMetadata `yaml:",omitempty"`
Lifecycle Lifecycle `yaml:",omitempty"`
Outputs []Output `yaml:",omitempty"`
Parameters []Parameter `yaml:",omitempty"`
Templates TemplateSetup `yaml:",omitempty"`
Document string `yaml:",omitempty"`
}
type ParametersManifest struct {
Parameters []Parameter `yaml:",omitempty"`
Outputs []Output `yaml:",omitempty"`
}
type ParametersBundle struct {
Name string
Parameters []string
}
type WellKnownParametersManifest struct {
Parameters []Parameter
Bundles []ParametersBundle
}
func (p *Parameter) QName() string {
return ParameterQualifiedName(p.Name, p.Component)
}
func ParameterQualifiedName(name, component string) string {
if component != "" {
return fmt.Sprintf("%s|%s", name, component)
}
return name
}