workers: Backwards compatible api.openshift.com spec compliance

The main changes are:
- Kind, Href, Id fields for every object returned
- Attach operationIds to each request, return it for errors
- Errors are predefined and queryable
This commit is contained in:
sanne 2021-08-31 11:47:27 +02:00 committed by Tom Gundersen
parent 5e206322a2
commit 2f328b0e97
14 changed files with 816 additions and 209 deletions

View file

@ -1,9 +1,6 @@
package worker
import (
"encoding/json"
"github.com/google/uuid"
"github.com/osbuild/osbuild-composer/internal/distro"
osbuild "github.com/osbuild/osbuild-composer/internal/osbuild1"
"github.com/osbuild/osbuild-composer/internal/target"
@ -76,29 +73,9 @@ type KojiFinalizeJobResult struct {
}
//
// JSON-serializable types for the HTTP API
// JSON-serializable types for the client
//
type statusResponse struct {
Status string `json:"status"`
}
type requestJobResponse struct {
Id uuid.UUID `json:"id"`
Location string `json:"location"`
ArtifactLocation string `json:"artifact_location"`
Type string `json:"type"`
Args json.RawMessage `json:"args,omitempty"`
DynamicArgs []json.RawMessage `json:"dynamic_args,omitempty"`
}
type getJobResponse struct {
Canceled bool `json:"canceled"`
}
type updateJobRequest struct {
Result json.RawMessage `json:"result"`
}
type updateJobResponse struct {
Result interface{} `json:"result"`
}