Skip to content

Instantly share code, notes, and snippets.

@codegold79
Last active October 2, 2020 02:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codegold79/e12954a97d09228ae736d817a968f7ee to your computer and use it in GitHub Desktop.
Save codegold79/e12954a97d09228ae736d817a968f7ee to your computer and use it in GitHub Desktop.
func newClient(ctx context.Context, cfg *vcConfig) (*vsClient, error) {
u := url.URL{
Scheme: "https",
Host: cfg.VCenter.Server,
Path: "sdk",
}
u.User = url.UserPassword(cfg.VCenter.User, cfg.VCenter.Password)
insecure := cfg.VCenter.Insecure
gc, err := govmomi.NewClient(ctx, &u, insecure)
if err != nil {
return nil, fmt.Errorf("connecting to vSphere API: %w", err)
}
vsc := vsClient{
govmomi: gc,
}
return &vsc, nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment