debian-forge-composer/internal/target/gcp_target.go
Tomas Hozza 6f464949f5 target: move Filename from target options to Target
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.
2022-07-01 18:55:01 +01:00

33 lines
1 KiB
Go

package target
const TargetNameGCP TargetName = "org.osbuild.gcp"
type GCPTargetOptions struct {
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,omitempty"`
// If provided, these credentials are used by the worker to import the image
// to GCP. If not provided, the worker will try to authenticate using the
// credentials from worker's configuration.
Credentials []byte `json:"credentials,omitempty"`
}
func (GCPTargetOptions) isTargetOptions() {}
func NewGCPTarget(options *GCPTargetOptions) *Target {
return newTarget(TargetNameGCP, options)
}
type GCPTargetResultOptions struct {
ImageName string `json:"image_name"`
ProjectID string `json:"project_id"`
}
func (GCPTargetResultOptions) isTargetResultOptions() {}
func NewGCPTargetResult(options *GCPTargetResultOptions) *TargetResult {
return newTargetResult(TargetNameGCP, options)
}