Merge pull request #39 from tboerger/add-marshaller

Add yaml marshalling for variable and parameter
This commit is contained in:
Brad Rydzewski 2019-04-23 16:17:50 -07:00 committed by GitHub
commit 5b0d86fdd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 4 deletions

View File

@ -42,3 +42,16 @@ func (v *Variable) UnmarshalYAML(unmarshal func(interface{}) error) error {
v.Secret = d.Secret
return err
}
// MarshalYAML implements yaml marshalling.
func (v *Variable) MarshalYAML() (interface{}, error) {
if v.Secret != "" {
m := map[string]interface{}{}
m["from_secret"] = v.Secret
return m, nil
}
if v.Value != "" {
return v.Value, nil
}
return nil, nil
}

View File

@ -34,7 +34,7 @@ type (
func (p *Parameter) UnmarshalYAML(unmarshal func(interface{}) error) error {
d := new(parameter)
err := unmarshal(d)
if err == nil && d.Secret != ""{
if err == nil && d.Secret != "" {
p.Secret = d.Secret
return nil
}
@ -43,3 +43,16 @@ func (p *Parameter) UnmarshalYAML(unmarshal func(interface{}) error) error {
p.Value = i
return err
}
// MarshalYAML implements yaml marshalling.
func (p *Parameter) MarshalYAML() (interface{}, error) {
if p.Secret != "" {
m := map[string]interface{}{}
m["from_secret"] = p.Secret
return m, nil
}
if p.Value != "" {
return p.Value, nil
}
return nil, nil
}