packer-cn/builder/vsphere/examples/driver/main.go

26 lines
448 B
Go

package main
import (
"fmt"
"github.com/hashicorp/packer/builder/vsphere/driver"
)
func main() {
d, err := driver.NewDriver(&driver.ConnectConfig{
VCenterServer: "vcenter.vsphere65.test",
Username: "root",
Password: "jetbrains",
InsecureConnection: true,
})
if err != nil {
panic(err)
}
ds, err := d.FindDatastore("", "esxi-1.vsphere65.test")
if err != nil {
panic(err)
}
fmt.Println(ds.Name())
}