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:
Lars Karlitski 2020-10-24 13:40:08 +02:00
parent 669b612d96
commit bcd57a77e2
5 changed files with 62 additions and 67 deletions

View file

@ -91,7 +91,7 @@ func (u *uploadRequest) UnmarshalJSON(data []byte) error {
//
// This also ignores any sensitive data passed into targets. Access keys may
// be passed as input to composer, but should not be possible to be queried.
func targetsToUploadResponses(targets []*target.Target, state common.ComposeState) []uploadResponse {
func targetsToUploadResponses(targets []*target.Target, state ComposeState) []uploadResponse {
var uploads []uploadResponse
for _, t := range targets {
upload := uploadResponse{
@ -101,13 +101,13 @@ func targetsToUploadResponses(targets []*target.Target, state common.ComposeStat
}
switch state {
case common.CWaiting:
case CWaiting:
upload.Status = common.IBWaiting
case common.CRunning:
case CRunning:
upload.Status = common.IBRunning
case common.CFinished:
case CFinished:
upload.Status = common.IBFinished
case common.CFailed:
case CFailed:
upload.Status = common.IBFailed
}