targets: add dummy azure and aws targets

These are not currently implemented in the backend, but shows how
the API will look like.

Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
Tom Gundersen 2019-11-22 13:31:05 +01:00 committed by Ondřej Budai
parent 283e89d0f4
commit e98b189b82
6 changed files with 45 additions and 7 deletions

View file

@ -0,0 +1,18 @@
package target
type AWSTargetOptions struct {
Region string `json:"region"`
AccessKeyID string `json:"accessKeyID"`
SecretAccessKey string `json:"secretAccessKey"`
Bucket string `json:"bucket"`
Key string `json:"key"`
}
func (AWSTargetOptions) isTargetOptions() {}
func NewAWSTarget(options *AWSTargetOptions) *Target {
return &Target{
Name: "org.osbuild.aws",
Options: options,
}
}

View file

@ -0,0 +1,16 @@
package target
type AzureTargetOptions struct {
Account string `json:"account"`
AccessKey string `json:"accessKey"`
Container string `json:"container"`
}
func (AzureTargetOptions) isTargetOptions() {}
func NewAzureTarget(options *AzureTargetOptions) *Target {
return &Target{
Name: "org.osbuild.azure",
Options: options,
}
}

View file

@ -6,12 +6,6 @@ type LocalTargetOptions struct {
func (LocalTargetOptions) isTargetOptions() {}
func NewLocalTargetOptions(location string) *LocalTargetOptions {
return &LocalTargetOptions{
Location: location,
}
}
func NewLocalTarget(options *LocalTargetOptions) *Target {
return &Target{
Name: "org.osbuild.local",

View file

@ -27,6 +27,10 @@ func (target *Target) UnmarshalJSON(data []byte) error {
}
var options TargetOptions
switch rawTarget.Name {
case "org.osbuild.azure":
options = new(AzureTargetOptions)
case "org.osbuild.aws":
options = new(AWSTargetOptions)
case "org.osbuild.local":
options = new(LocalTargetOptions)
default: