The filename of the image as produced by osbuild for a given export is currently set in each target options type in the `Filename` struct member. However, the value is not really specific to any target type, but to the specific export used for the target. For this reason move the value form target type options to the `Target` struct inside a new struct `OsbuildArtifact` under the name`ExportFilename`. The backward compatibility with older implementations of the composer and workers is kept on the JSON (Un)mashaling level, where the JSON object is always a super-set of the old and new way of providing the export filename in the Target.
61 lines
1.8 KiB
Go
61 lines
1.8 KiB
Go
package target
|
|
|
|
const (
|
|
TargetNameAWS TargetName = "org.osbuild.aws"
|
|
TargetNameAWSS3 TargetName = "org.osbuild.aws.s3"
|
|
)
|
|
|
|
type AWSTargetOptions struct {
|
|
Region string `json:"region"`
|
|
AccessKeyID string `json:"accessKeyID"`
|
|
SecretAccessKey string `json:"secretAccessKey"`
|
|
SessionToken string `json:"sessionToken"`
|
|
Bucket string `json:"bucket"`
|
|
Key string `json:"key"`
|
|
ShareWithAccounts []string `json:"shareWithAccounts"`
|
|
}
|
|
|
|
func (AWSTargetOptions) isTargetOptions() {}
|
|
|
|
func NewAWSTarget(options *AWSTargetOptions) *Target {
|
|
return newTarget(TargetNameAWS, options)
|
|
}
|
|
|
|
type AWSTargetResultOptions struct {
|
|
Ami string `json:"ami"`
|
|
Region string `json:"region"`
|
|
}
|
|
|
|
func (AWSTargetResultOptions) isTargetResultOptions() {}
|
|
|
|
func NewAWSTargetResult(options *AWSTargetResultOptions) *TargetResult {
|
|
return newTargetResult(TargetNameAWS, options)
|
|
}
|
|
|
|
type AWSS3TargetOptions struct {
|
|
Region string `json:"region"`
|
|
AccessKeyID string `json:"accessKeyID"`
|
|
SecretAccessKey string `json:"secretAccessKey"`
|
|
SessionToken string `json:"sessionToken"`
|
|
Bucket string `json:"bucket"`
|
|
Key string `json:"key"`
|
|
Endpoint string `json:"endpoint"`
|
|
CABundle string `json:"ca_bundle"`
|
|
SkipSSLVerification bool `json:"skip_ssl_verification"`
|
|
}
|
|
|
|
func (AWSS3TargetOptions) isTargetOptions() {}
|
|
|
|
func NewAWSS3Target(options *AWSS3TargetOptions) *Target {
|
|
return newTarget(TargetNameAWSS3, options)
|
|
}
|
|
|
|
type AWSS3TargetResultOptions struct {
|
|
URL string `json:"url"`
|
|
}
|
|
|
|
func (AWSS3TargetResultOptions) isTargetResultOptions() {}
|
|
|
|
func NewAWSS3TargetResult(options *AWSS3TargetResultOptions) *TargetResult {
|
|
return newTargetResult(TargetNameAWSS3, options)
|
|
}
|