weldr: move common.ComposeState to weldr
ComposeState is only used by the weldr API. Drop the JSON marshaller and unmarshaller, because ComposeState is not used in an JSON-exported field anymore.
This commit is contained in:
parent
669b612d96
commit
bcd57a77e2
5 changed files with 62 additions and 67 deletions
|
|
@ -69,31 +69,3 @@ func (ibs *ImageBuildState) UnmarshalJSON(data []byte) error {
|
|||
func (ibs ImageBuildState) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(getStateMapping()[ibs])
|
||||
}
|
||||
|
||||
type ComposeState int
|
||||
|
||||
const (
|
||||
CWaiting ComposeState = iota
|
||||
CRunning
|
||||
CFinished
|
||||
CFailed
|
||||
)
|
||||
|
||||
// ToString converts ImageBuildState into a human readable string
|
||||
func (cs ComposeState) ToString() string {
|
||||
return getStateMapping()[int(cs)]
|
||||
}
|
||||
|
||||
// UnmarshalJSON converts a JSON string into an ImageBuildState
|
||||
func (ibs *ComposeState) UnmarshalJSON(data []byte) error {
|
||||
val, err := unmarshalStateHelper(data, getStateMapping())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*ibs = ComposeState(val)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ibs ComposeState) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(getStateMapping()[ibs])
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue