New upload target: AWS S3

Uploads an artifact to an S£ bucket and returns a presigned URL to allow
the user to download the file.

Although it uses a lot of common code with the AWS AMI upload target,
it's treated as a completely separate target.
This commit is contained in:
Achilleas Koutsou 2021-05-27 14:52:32 +02:00 committed by Tom Gundersen
parent 14aea30bcd
commit e5b28c0bb3
8 changed files with 185 additions and 51 deletions

View file

@ -26,3 +26,28 @@ func (AWSTargetResultOptions) isTargetResultOptions() {}
func NewAWSTargetResult(options *AWSTargetResultOptions) *TargetResult {
return newTargetResult("org.osbuild.aws", options)
}
type AWSS3TargetOptions struct {
Filename string `json:"filename"`
Region string `json:"region"`
AccessKeyID string `json:"accessKeyID"`
SecretAccessKey string `json:"secretAccessKey"`
Bucket string `json:"bucket"`
Key string `json:"key"`
}
func (AWSS3TargetOptions) isTargetOptions() {}
func NewAWSS3Target(options *AWSS3TargetOptions) *Target {
return newTarget("org.osbuild.aws.s3", options)
}
type AWSS3TargetResultOptions struct {
URL string `json:"url"`
}
func (AWSS3TargetResultOptions) isTargetResultOptions() {}
func NewAWSS3TargetResult(options *AWSS3TargetResultOptions) *TargetResult {
return newTargetResult("org.osbuild.aws.s3", options)
}

View file

@ -69,6 +69,8 @@ func UnmarshalTargetOptions(targetName string, rawOptions json.RawMessage) (Targ
options = new(AzureTargetOptions)
case "org.osbuild.aws":
options = new(AWSTargetOptions)
case "org.osbuild.aws.s3":
options = new(AWSS3TargetOptions)
case "org.osbuild.gcp":
options = new(GCPTargetOptions)
case "org.osbuild.azure.image":

View file

@ -47,6 +47,8 @@ func UnmarshalTargetResultOptions(trName string, rawOptions json.RawMessage) (Ta
switch trName {
case "org.osbuild.aws":
options = new(AWSTargetResultOptions)
case "org.osbuild.aws.s3":
options = new(AWSS3TargetResultOptions)
case "org.osbuild.gcp":
options = new(GCPTargetResultOptions)
case "org.osbuild.azure.image":