cloudapi: Add support for GCP as upload target

Add support for GCP as an upload target to the internal API.

Extend the cloudapi to allow GCP as an upload target in the compose
request. Regenerate the cloudapi go code. Added GCP-specific upload
result component in the API definition, similar to AWS. It is not yet
used, but it will be once returning a target-specific result from
worker is supported.

Add support for GCP upload target to the worker job implementation.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
This commit is contained in:
Tomas Hozza 2021-02-22 12:12:13 +01:00 committed by Tom Gundersen
parent ff95059748
commit 94d399f010
7 changed files with 251 additions and 36 deletions

View file

@ -0,0 +1,16 @@
package target
type GCPTargetOptions struct {
Filename string `json:"filename"`
Region string `json:"region"`
Os string `json:"os"` // not exposed in cloudapi for now
Bucket string `json:"bucket"`
Object string `json:"object"`
ShareWithAccounts []string `json:"shareWithAccounts"`
}
func (GCPTargetOptions) isTargetOptions() {}
func NewGCPTarget(options *GCPTargetOptions) *Target {
return newTarget("org.osbuild.gcp", options)
}

View file

@ -3,9 +3,10 @@ package target
import (
"encoding/json"
"errors"
"time"
"github.com/google/uuid"
"github.com/osbuild/osbuild-composer/internal/common"
"time"
)
type Target struct {
@ -68,6 +69,8 @@ func UnmarshalTargetOptions(targetName string, rawOptions json.RawMessage) (Targ
options = new(AzureTargetOptions)
case "org.osbuild.aws":
options = new(AWSTargetOptions)
case "org.osbuild.gcp":
options = new(GCPTargetOptions)
case "org.osbuild.local":
options = new(LocalTargetOptions)
case "org.osbuild.koji":