debian-forge-composer/internal/worker/json.go
Lars Karlitski ca35f25fcf worker/client: expose server errors
The worker API returns errors of the form:

  { "message": "..." }

Print the message of those errors when receiving an error on the client.

This adds an `Error` type to openapi.yml and marks all routes as
returning it on 4XX and 5XX.
2020-09-11 14:23:24 +01:00

50 lines
1.2 KiB
Go

package worker
import (
"github.com/google/uuid"
"github.com/osbuild/osbuild-composer/internal/common"
"github.com/osbuild/osbuild-composer/internal/distro"
"github.com/osbuild/osbuild-composer/internal/osbuild"
"github.com/osbuild/osbuild-composer/internal/target"
)
//
// JSON-serializable types for the jobqueue
//
type OSBuildJob struct {
Manifest distro.Manifest `json:"manifest"`
Targets []*target.Target `json:"targets,omitempty"`
}
type OSBuildJobResult struct {
OSBuildOutput *osbuild.Result `json:"osbuild_output,omitempty"`
}
//
// JSON-serializable types for the HTTP API
//
type statusResponse struct {
Status string `json:"status"`
}
type requestJobResponse struct {
Id uuid.UUID `json:"id"`
Manifest distro.Manifest `json:"manifest"`
Targets []*target.Target `json:"targets,omitempty"`
Location string `json:"location"`
ArtifactLocation string `json:"artifact_location"`
}
type getJobResponse struct {
Canceled bool `json:"canceled"`
}
type updateJobRequest struct {
Status common.ImageBuildState `json:"status"`
Result *osbuild.Result `json:"result"`
}
type updateJobResponse struct {
}