forked from cloudfoundry/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
application.go
33 lines (28 loc) · 905 Bytes
/
application.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
package manifestparser
// ApplicationModel can be accessed through the top level Application struct To
// add a field for the CLI to extract from the manifest, just add it to this
// struct.
type ApplicationModel struct {
Name string `yaml:"name"`
Docker *Docker `yaml:"docker"`
Path string `yaml:"path"`
NoRoute bool `yaml:"no-route"`
}
type Application struct {
ApplicationModel
FullUnmarshalledApplication map[string]interface{}
}
func (application Application) MarshalYAML() (interface{}, error) {
return application.FullUnmarshalledApplication, nil
}
func (application *Application) UnmarshalYAML(unmarshal func(v interface{}) error) error {
err := unmarshal(&application.FullUnmarshalledApplication)
if err != nil {
return err
}
return unmarshal(&application.ApplicationModel)
}
type Docker struct {
Image string `yaml:"image"`
Username string `yaml:"username"`
}