forked from cloudfoundry-attic/bosh-ext-cli
/
config.go
40 lines (30 loc) · 1.15 KB
/
config.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
package manifest
import (
bosherr "github.com/cloudfoundry/bosh-utils/errors"
"gopkg.in/yaml.v2"
check "github.com/bosh-tools/bosh-ext-cli/lint/check"
)
type Config struct {
ManifestName check.Config `yaml:"manifest_name"`
RootProperties check.Config `yaml:"root_properties"`
TopLevelJobs check.Config `yaml:"top_level_jobs"`
TopLevelNetworks check.Config `yaml:"top_level_networks"`
YAMLAnchors check.Config `yaml:"yaml_anchors"`
VarInterpolation check.Config `yaml:"var_interpolation"`
StemcellAlias check.Config `yaml:"stemcell_alias"`
IGName check.Config `yaml:"instance_group_name"`
IGAZs check.Config `yaml:"instance_group_azs"`
IGStemcell check.Config `yaml:"instance_group_stemcell"`
IGProperties check.Config `yaml:"instance_group_properties"`
IGLinks check.Config `yaml:"instance_group_links"`
StaticIPs check.Config `yaml:"static_ips"`
VariableName check.Config `yaml:"variable_name"`
}
func NewConfig(bytes []byte) (Config, error) {
config := Config{}
err := yaml.Unmarshal(bytes, &config)
if err != nil {
return Config{}, bosherr.WrapError(err, "Unmarshalling config")
}
return config, nil
}