Ensure that `UnmarshalTargetResultOptions()` is called only when there are any options to unmarshal in the JSON object. Since results of some Targets don't have any options defined, mark `TargetResult.Options` as optional in the JSON tag.
23 lines
620 B
Go
23 lines
620 B
Go
package target
|
|
|
|
const TargetNameVMWare TargetName = "org.osbuild.vmware"
|
|
|
|
type VMWareTargetOptions struct {
|
|
Filename string `json:"filename"`
|
|
Host string `json:"host"`
|
|
Username string `json:"username"`
|
|
Password string `json:"password"`
|
|
Datacenter string `json:"datacenter"`
|
|
Cluster string `json:"cluster"`
|
|
Datastore string `json:"datastore"`
|
|
}
|
|
|
|
func (VMWareTargetOptions) isTargetOptions() {}
|
|
|
|
func NewVMWareTarget(options *VMWareTargetOptions) *Target {
|
|
return newTarget(TargetNameVMWare, options)
|
|
}
|
|
|
|
func NewVMWareTargetResult() *TargetResult {
|
|
return newTargetResult(TargetNameVMWare, nil)
|
|
}
|