pkg/api/admin/marshal.go (16 lines of code) (raw):
package admin
// Copyright (c) Microsoft Corporation.
// Licensed under the Apache License 2.0.
import (
"encoding/json"
)
// MarshalJSON marshals an InstallPhase
func (p InstallPhase) MarshalJSON() ([]byte, error) {
return json.Marshal(p.String())
}
// UnmarshalJSON unmarshals an InstallPhase
func (p *InstallPhase) UnmarshalJSON(b []byte) error {
var s string
err := json.Unmarshal(b, &s)
if err != nil {
return err
}
*p, err = InstallPhaseString(s)
return err
}