Skip to content

Instantly share code, notes, and snippets.

@codegold79
Created October 2, 2020 02:26
Show Gist options
  • Select an option

  • Save codegold79/75dd14456ac0be0d9b42ad6c8590d20c to your computer and use it in GitHub Desktop.

Select an option

Save codegold79/75dd14456ac0be0d9b42ad6c8590d20c to your computer and use it in GitHub Desktop.
func (c *vsClient) moVirtualMachine(ctx context.Context, mor types.ManagedObjectReference) (mo.VirtualMachine, error) {
var moVM mo.VirtualMachine
pc := property.DefaultCollector(c.govmomi.Client)
err := pc.Retrieve(ctx, []types.ManagedObjectReference{mor}, []string{}, &moVM)
if err != nil {
return mo.VirtualMachine{}, err
}
return moVM, nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment