rpc: implement YAML marshaling/unmarshaling for StackParamType
This commit is contained in:
parent
34e2122e58
commit
7d89ccdb6f
1 changed files with 17 additions and 0 deletions
|
@ -103,6 +103,23 @@ func (t *StackParamType) UnmarshalJSON(data []byte) (err error) {
|
||||||
return
|
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.
|
// StackParam represent a stack parameter.
|
||||||
type StackParam struct {
|
type StackParam struct {
|
||||||
Type StackParamType `json:"type"`
|
Type StackParamType `json:"type"`
|
||||||
|
|
Loading…
Reference in a new issue