vsphere/internal/helper/envbrowse/environment_browser_helper.go
func (b *EnvironmentBrowser) DefaultDevices(ctx context.Context, key string, host *object.HostSystem) (object.VirtualDeviceList, error) {
	var eb mo.EnvironmentBrowser

	err := b.Properties(ctx, b.Reference(), nil, &eb)
	if err != nil {
		return nil, err
	}

	req := types.QueryConfigOption{
		This: b.Reference(),
		Key:  key,
	}
	if host != nil {
		ref := host.Reference()
		req.Host = &ref
	}
	res, err := methods.QueryConfigOption(ctx, b.Client(), &req)
	if err != nil {
		return nil, err
	}
	if res.Returnval == nil {
		return nil, errors.New("no config options were found for the supplied criteria")
	}
	return object.VirtualDeviceList(res.Returnval.DefaultDevice), nil
}
func (b *EnvironmentBrowser) DefaultDevices(ctx context.Context, key string, host *object.HostSystem) (object.VirtualDeviceList, error) {
	var eb mo.EnvironmentBrowser

	err := b.Properties(ctx, b.Reference(), nil, &eb)
	if err != nil {
		return nil, err
	}

	req := types.QueryConfigOption{
		This: b.Reference(),
		Key:  key,
	}
	if host != nil {
		ref := host.Reference()
		req.Host = &ref
	}
	res, err := methods.QueryConfigOption(ctx, b.Client(), &req)
	if err != nil {
		return nil, err
	}
	if res.Returnval == nil {
		return nil, errors.New("no config options were found for the supplied criteria")
	}
	return object.VirtualDeviceList(res.Returnval.DefaultDevice), nil
}
func ( b * EnvironmentBrowser ) DefaultDevices ( ctx context . Context , key string , host * object . HostSystem ) ( object . VirtualDeviceList , error ) { var eb mo . EnvironmentBrowser err := b . Properties ( ctx , b . Reference ( ) , nil , & eb ) if err != nil { return nil , err } req := types . QueryConfigOption { This : b . Reference ( ) , Key : key , } if host != nil { ref := host . Reference ( ) req . Host = & ref } res , err := methods . QueryConfigOption ( ctx , b . Client ( ) , & req ) if err != nil { return nil , err } if res . Returnval == nil { return nil , errors . New ( " " ) } return object . VirtualDeviceList ( res . Returnval . DefaultDevice ) , nil }
// DefaultDevices loads a satisfactory default device list for the optionally
// supplied host and descriptor key. The result is returned as a higher-level
// VirtualDeviceList object. This can be used as an initial VirtualDeviceList
// when building a device list and VirtualDeviceConfigSpec list for new virtual
// machines.
//
// Appropriate options for key can be loaded by running
// QueryConfigOptionDescriptor, which will return a list of
// VirtualMachineConfigOptionDescriptor which will contain the appropriate key
// for the virtual machine version needed. If no key is supplied, the results
// generally reflect the most recent VM hardware version.
DefaultDevices loads a satisfactory default device list for the optionally supplied host and descriptor key . The result is returned as a higher - level VirtualDeviceList object . This can be used as an initial VirtualDeviceList when building a device list and VirtualDeviceConfigSpec list for new virtual machines . Appropriate options for key can be loaded by running QueryConfigOptionDescriptor which will return a list of VirtualMachineConfigOptionDescriptor which will contain the appropriate key for the virtual machine version needed . If no key is supplied the results generally reflect the most recent VM hardware version .