vsphere/internal/helper/dvportgroup/distributed_port_group_helper.go
func FromMOID(client *govmomi.Client, id string) (*object.DistributedVirtualPortgroup, error) {
	finder := find.NewFinder(client.Client, false)

	ref := types.ManagedObjectReference{
		Type:  "DistributedVirtualPortgroup",
		Value: id,
	}

	ctx, cancel := context.WithTimeout(context.Background(), provider.DefaultAPITimeout)
	defer cancel()
	ds, err := finder.ObjectReference(ctx, ref)
	if err != nil {
		return nil, err
	}
	// Should be safe to return here. If our reference returned here and is not a
	// DistributedVirtualPortgroup, then we have bigger problems and to be
	// honest we should be panicking anyway.
	return ds.(*object.DistributedVirtualPortgroup), nil
}
func FromMOID(client *govmomi.Client, id string) (*object.DistributedVirtualPortgroup, error) {
	finder := find.NewFinder(client.Client, false)

	ref := types.ManagedObjectReference{
		Type:  "DistributedVirtualPortgroup",
		Value: id,
	}

	ctx, cancel := context.WithTimeout(context.Background(), provider.DefaultAPITimeout)
	defer cancel()
	ds, err := finder.ObjectReference(ctx, ref)
	if err != nil {
		return nil, err
	}
	// Should be safe to return here. If our reference returned here and is not a
	// DistributedVirtualPortgroup, then we have bigger problems and to be
	// honest we should be panicking anyway.
	return ds.(*object.DistributedVirtualPortgroup), nil
}
// FromMOID locates a portgroup by its managed object reference ID.