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

26 lines
448 B
Go
Raw Normal View History

2018-03-20 19:03:47 -04:00
package main
import (
"fmt"
"github.com/hashicorp/packer/builder/vsphere/driver"
2018-03-20 19:03:47 -04:00
)
func main() {
2018-10-31 17:42:24 -04:00
d, err := driver.NewDriver(&driver.ConnectConfig{
2018-03-20 19:03:47 -04:00
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())
}