rpc: implement YAML marshaling/unmarshaling for StackParamType

This commit is contained in:
Roman Khimov 2019-11-20 11:08:48 +03:00
parent 34e2122e58
commit 7d89ccdb6f

View file

@ -103,6 +103,23 @@ func (t *StackParamType) UnmarshalJSON(data []byte) (err error) {
return
}
// MarshalYAML implements the YAML Marshaler interface.
func (t *StackParamType) MarshalYAML() (interface{}, error) {
return t.String(), nil
}
// UnmarshalYAML implements the YAML Unmarshaler interface.
func (t *StackParamType) UnmarshalYAML(unmarshal func(interface{}) error) error {
var name string
err := unmarshal(&name)
if err != nil {
return err
}
*t, err = StackParamTypeFromString(name)
return err
}
// StackParam represent a stack parameter.
type StackParam struct {
Type StackParamType `json:"type"`