// GetVnic will return the specified VNIC
GetVnic will return the specified VNIC
// GetVnic will return the specified VNIC
func (v *VirtualMachine) GetVnic(name string) (Vnic, error) {
	vmID, err := v.ID()
	if err != nil {
		return Vnic{}, errors.Wrap(err, "VM ID")
	}
	extraQ := []wmi.Query{
		&wmi.AndQuery{
			wmi.QueryFields{
				Key:   "ElementName",
				Value: name,
				Type:  wmi.Equals},
		},
	}
	nic, err := utils.GetElementsAssociatedClass(v.mgr.con, SyntheticEthernetPortSettingDataClass, vmID, extraQ)
	if err != nil {
		return Vnic{}, errors.Wrap(err, "utils.GetElementsAssociatedClass")
	}
	if len(nic) == 0 {
		return Vnic{}, wmi.ErrNotFound
	}
	return Vnic{
		mgr:    v.mgr,
		path:   nic[0],
		vmPath: v.path,
	}, nil
}
func ( v * VirtualMachine ) GetVnic ( name string ) ( Vnic , error ) { vmID , err := v . ID ( ) if err != nil { return Vnic { } , errors . Wrap ( err , " " ) } extraQ := [ ] wmi . Query { & wmi . AndQuery { wmi . QueryFields { Key : " " , Value : name , Type : wmi . Equals } , } , } nic , err := utils . GetElementsAssociatedClass ( v . mgr . con , SyntheticEthernetPortSettingDataClass , vmID , extraQ ) if err != nil { return Vnic { } , errors . Wrap ( err , " " ) } if len ( nic ) == 0 { return Vnic { } , wmi . ErrNotFound } return Vnic { mgr : v . mgr , path : nic [ 0 ] , vmPath : v . path , } , nil }
GetVnic will return the specified VNIC
GetVnic will return the specified VNIC