Last active
October 2, 2020 02:59
-
-
Save codegold79/e12954a97d09228ae736d817a968f7ee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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