api/cloud: remove magic constants

UploadTypes_* constants are auto-generated from the openapi spec.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
This commit is contained in:
Ondřej Budai 2021-03-03 12:24:52 +01:00 committed by Tom Gundersen
parent 4b031a4692
commit 61e97372df

View file

@ -171,7 +171,7 @@ func (server *Server) Compose(w http.ResponseWriter, r *http.Request) {
} }
uploadRequest := (ir.UploadRequests)[0] uploadRequest := (ir.UploadRequests)[0]
/* oneOf is not supported by the openapi generator so marshal and unmarshal the uploadrequest based on the type */ /* oneOf is not supported by the openapi generator so marshal and unmarshal the uploadrequest based on the type */
if uploadRequest.Type == "aws" { if uploadRequest.Type == UploadTypes_aws {
var awsUploadOptions AWSUploadRequestOptions var awsUploadOptions AWSUploadRequestOptions
jsonUploadOptions, err := json.Marshal(uploadRequest.Options) jsonUploadOptions, err := json.Marshal(uploadRequest.Options)
if err != nil { if err != nil {
@ -205,7 +205,7 @@ func (server *Server) Compose(w http.ResponseWriter, r *http.Request) {
} }
targets = append(targets, t) targets = append(targets, t)
} else if uploadRequest.Type == "gcp" { } else if uploadRequest.Type == UploadTypes_gcp {
var gcpUploadOptions GCPUploadRequestOptions var gcpUploadOptions GCPUploadRequestOptions
jsonUploadOptions, err := json.Marshal(uploadRequest.Options) jsonUploadOptions, err := json.Marshal(uploadRequest.Options)
if err != nil { if err != nil {