provider/vsphere/vsphere_discover.go
func newVSphereClient(ctx context.Context, host, user, password string, insecure bool) (*vSphereClient, error) {
	logger.Println("[DEBUG] Connecting to vSphere client endpoints")

	client := new(vSphereClient)

	u, err := vimURL(host, user, password)
	if err != nil {
		return nil, fmt.Errorf("error generating SOAP endpoint url: %s", err)
	}

	// Set up the VIM/govmomi client connection
	client.VimClient, err = newVimSession(ctx, u, insecure)
	if err != nil {
		return nil, err
	}

	client.TagsClient, err = newRestSession(ctx, u, insecure)
	if err != nil {
		return nil, err
	}

	logger.Println("[DEBUG] All vSphere client endpoints connected successfully")
	return client, nil
}
func newVSphereClient(ctx context.Context, host, user, password string, insecure bool) (*vSphereClient, error) {
	logger.Println("[DEBUG] Connecting to vSphere client endpoints")

	client := new(vSphereClient)

	u, err := vimURL(host, user, password)
	if err != nil {
		return nil, fmt.Errorf("error generating SOAP endpoint url: %s", err)
	}

	// Set up the VIM/govmomi client connection
	client.VimClient, err = newVimSession(ctx, u, insecure)
	if err != nil {
		return nil, err
	}

	client.TagsClient, err = newRestSession(ctx, u, insecure)
	if err != nil {
		return nil, err
	}

	logger.Println("[DEBUG] All vSphere client endpoints connected successfully")
	return client, nil
}
func newVSphereClient ( ctx context . Context , host , user , password string , insecure bool ) ( * vSphereClient , error ) { logger . Println ( " " ) client := new ( vSphereClient ) u , err := vimURL ( host , user , password ) if err != nil { return nil , fmt . Errorf ( " " , err ) } // Set up the VIM/govmomi client connection client . VimClient , err = newVimSession ( ctx , u , insecure ) if err != nil { return nil , err } client . TagsClient , err = newRestSession ( ctx , u , insecure ) if err != nil { return nil , err } logger . Println ( " " ) return client , nil }
// newVSphereClient returns a new vSphereClient after setting up the necessary
// connections.
newVSphereClient returns a new vSphereClient after setting up the necessary connections .