Documentation
¶
Index ¶
- Constants
- func Base64Decode(src []byte) ([]byte, error)
- func DevicesFromConfigSpec(configSpec *vimTypes.VirtualMachineConfigSpec) []vimTypes.BaseVirtualDevice
- func IsDeviceDynamicDirectPathIO(dev vimTypes.BaseVirtualDevice) bool
- func IsDeviceNvidiaVgpu(dev vimTypes.BaseVirtualDevice) bool
- func IsEthernetCard(dev vimTypes.BaseVirtualDevice) bool
- func MarshalConfigSpecToJSON(configSpec *vimTypes.VirtualMachineConfigSpec) ([]byte, error)
- func MarshalConfigSpecToXML(configSpec *vimTypes.VirtualMachineConfigSpec) ([]byte, error)
- func RemoveDevicesFromConfigSpec(configSpec *vimTypes.VirtualMachineConfigSpec, ...)
- func SanitizeVMClassConfigSpec(configSpec *vimTypes.VirtualMachineConfigSpec)
- func SelectDevices[T vimTypes.BaseVirtualDevice](devices []vimTypes.BaseVirtualDevice, selectorFns ...SelectDeviceFn[T]) []T
- func SelectDevicesByBackingType[B vimTypes.BaseVirtualDeviceBackingInfo](devices []vimTypes.BaseVirtualDevice) []vimTypes.BaseVirtualDevice
- func SelectDevicesByDeviceAndBackingType[T vimTypes.BaseVirtualDevice, B vimTypes.BaseVirtualDeviceBackingInfo](devices []vimTypes.BaseVirtualDevice) []T
- func SelectDevicesByType[T vimTypes.BaseVirtualDevice](devices []vimTypes.BaseVirtualDevice) []T
- func SelectDevicesByTypes(devices []vimTypes.BaseVirtualDevice, ...) []vimTypes.BaseVirtualDevice
- func SelectDynamicDirectPathIO(devices []vimTypes.BaseVirtualDevice) []*vimTypes.VirtualPCIPassthrough
- func SelectNvidiaVgpu(devices []vimTypes.BaseVirtualDevice) []*vimTypes.VirtualPCIPassthrough
- func SelectVirtualPCIPassthrough(devices []vimTypes.BaseVirtualDevice) []*vimTypes.VirtualPCIPassthrough
- func TryToDecodeBase64Gzip(data []byte) (string, error)
- func UnmarshalConfigSpecFromBase64XML(src []byte) (*vimTypes.VirtualMachineConfigSpec, error)
- func UnmarshalConfigSpecFromJSON(data []byte) (*vimTypes.VirtualMachineConfigSpec, error)
- func UnmarshalConfigSpecFromXML(data []byte) (*vimTypes.VirtualMachineConfigSpec, error)
- type Cache
- type CacheItem
- type CachePutResult
- type LockPool
- type SelectDeviceFn
Constants ¶
const (
// XsiNamespace indicates the XML schema instance namespace.
XsiNamespace = "http://www.w3.org/2001/XMLSchema-instance"
)
Variables ¶
This section is empty.
Functions ¶
func Base64Decode ¶
Base64Decode returns a byte slice decoded from a base64 byte slice.
func DevicesFromConfigSpec ¶
func DevicesFromConfigSpec( configSpec *vimTypes.VirtualMachineConfigSpec, ) []vimTypes.BaseVirtualDevice
DevicesFromConfigSpec returns a slice of devices from the ConfigSpec's DeviceChange property.
func IsDeviceDynamicDirectPathIO ¶
func IsDeviceDynamicDirectPathIO(dev vimTypes.BaseVirtualDevice) bool
IsDeviceDynamicDirectPathIO returns true if the provided device is a dynamic direct path I/O device..
func IsDeviceNvidiaVgpu ¶ added in v1.8.3
func IsDeviceNvidiaVgpu(dev vimTypes.BaseVirtualDevice) bool
IsDeviceNvidiaVgpu returns true if the provided device is an Nvidia vGPU.
func IsEthernetCard ¶
func IsEthernetCard(dev vimTypes.BaseVirtualDevice) bool
func MarshalConfigSpecToJSON ¶
func MarshalConfigSpecToJSON( configSpec *vimTypes.VirtualMachineConfigSpec) ([]byte, error)
MarshalConfigSpecToJSON returns a byte slice of the provided ConfigSpec marshaled to a JSON string.
func MarshalConfigSpecToXML ¶
func MarshalConfigSpecToXML( configSpec *vimTypes.VirtualMachineConfigSpec) ([]byte, error)
MarshalConfigSpecToXML returns a byte slice of the provided ConfigSpec marshalled to an XML string.
func RemoveDevicesFromConfigSpec ¶
func RemoveDevicesFromConfigSpec(configSpec *vimTypes.VirtualMachineConfigSpec, fn func(vimTypes.BaseVirtualDevice) bool)
RemoveDevicesFromConfigSpec removes devices from config spec device changes based on the matcher function.
func SanitizeVMClassConfigSpec ¶
func SanitizeVMClassConfigSpec(configSpec *vimTypes.VirtualMachineConfigSpec)
SanitizeVMClassConfigSpec clears fields in the class ConfigSpec that are not allowed or supported.
func SelectDevices ¶
func SelectDevices[T vimTypes.BaseVirtualDevice]( devices []vimTypes.BaseVirtualDevice, selectorFns ...SelectDeviceFn[T], ) []T
SelectDevices returns a slice of the devices that match at least one of the provided selector functions.
func SelectDevicesByBackingType ¶
func SelectDevicesByBackingType[B vimTypes.BaseVirtualDeviceBackingInfo]( devices []vimTypes.BaseVirtualDevice, ) []vimTypes.BaseVirtualDevice
SelectDevicesByBackingType returns a slice of the devices that have a backing of type B.
func SelectDevicesByDeviceAndBackingType ¶
func SelectDevicesByDeviceAndBackingType[ T vimTypes.BaseVirtualDevice, B vimTypes.BaseVirtualDeviceBackingInfo, ]( devices []vimTypes.BaseVirtualDevice, ) []T
SelectDevicesByDeviceAndBackingType returns a slice of the devices that are of type T with a backing of type B.
func SelectDevicesByType ¶
func SelectDevicesByType[T vimTypes.BaseVirtualDevice]( devices []vimTypes.BaseVirtualDevice, ) []T
SelectDevicesByType returns a slice of the devices that are of type T.
func SelectDevicesByTypes ¶
func SelectDevicesByTypes( devices []vimTypes.BaseVirtualDevice, deviceTypes ...vimTypes.BaseVirtualDevice, ) []vimTypes.BaseVirtualDevice
SelectDevicesByTypes returns a slice of the devices that match at least one the provided device types.
func SelectDynamicDirectPathIO ¶
func SelectDynamicDirectPathIO( devices []vimTypes.BaseVirtualDevice, ) []*vimTypes.VirtualPCIPassthrough
SelectDynamicDirectPathIO returns a slice of dynamic direct path I/O devices.
func SelectNvidiaVgpu ¶ added in v1.8.3
func SelectNvidiaVgpu( devices []vimTypes.BaseVirtualDevice, ) []*vimTypes.VirtualPCIPassthrough
SelectNvidiaVgpu return a slice of Nvidia vGPU devices.
func SelectVirtualPCIPassthrough ¶
func SelectVirtualPCIPassthrough( devices []vimTypes.BaseVirtualDevice, ) []*vimTypes.VirtualPCIPassthrough
SelectVirtualPCIPassthrough returns a slice of *VirtualPCIPassthrough devices.
func TryToDecodeBase64Gzip ¶
TryToDecodeBase64Gzip base64-decodes the provided data until the DecodeString function fails. If the result is gzipped, then it is decompressed and returned. Otherwise the decoded data is returned.
This function will also return the original data as a string if it was neither base64 encoded or gzipped.
func UnmarshalConfigSpecFromBase64XML ¶
func UnmarshalConfigSpecFromBase64XML( src []byte) (*vimTypes.VirtualMachineConfigSpec, error)
UnmarshalConfigSpecFromBase64XML returns a ConfigSpec object from a byte-slice of the ConfigSpec marshaled as a base64-encoded, XML string.
func UnmarshalConfigSpecFromJSON ¶
func UnmarshalConfigSpecFromJSON( data []byte) (*vimTypes.VirtualMachineConfigSpec, error)
UnmarshalConfigSpecFromJSON returns a ConfigSpec object from a byte-slice of the ConfigSpec marshaled as a JSON string.
func UnmarshalConfigSpecFromXML ¶
func UnmarshalConfigSpecFromXML( data []byte) (*vimTypes.VirtualMachineConfigSpec, error)
UnmarshalConfigSpecFromXML returns a ConfigSpec object from a byte-slice of the ConfigSpec marshaled as an XML string.
Types ¶
type Cache ¶ added in v1.8.1
type Cache[T any] struct { // contains filtered or unexported fields }
Cache is a generic implementation of a cache that can be configured with a maximum number of items and can evict items after a certain amount of time.
func NewCache ¶ added in v1.8.1
NewCache initializes a new cache with the provided expiration options.
func (*Cache[T]) Close ¶ added in v1.8.1
func (c *Cache[T]) Close()
Close shuts down the cache. It is safe to call this function more than once.
func (*Cache[T]) ExpiredChan ¶ added in v1.8.1
ExpiredChan returns a channel on which the IDs of items that are expired are sent. This channel is closed when the cache is closed, but only after all, pending eviction notices are received.
func (*Cache[T]) Get ¶ added in v1.8.1
Get returns the cached item with the provided ID. The function isHit may be optionally provided to further determine whether a cached item should hit or miss.
func (*Cache[T]) Put ¶ added in v1.8.1
func (c *Cache[T]) Put(id string, t T) CachePutResult
Put stores the provided item in the cache, updating existing items.
type CacheItem ¶ added in v1.8.1
type CacheItem[T any] struct { // Item is the cached item. Item T // LastUpdated is the last time the item was updated. LastUpdated time.Time }
CacheItem wraps T so it has a LastUpdated field and can be used with Cache.
type CachePutResult ¶ added in v1.8.1
type CachePutResult uint
CachePutResult describes the result of putting an item into the cache.
const ( // CachePutResultCreate indicates the item was created in the cache. CachePutResultCreate CachePutResult = iota + 1 // CachePutResultUpdate indicates an existing, cached item was updated. CachePutResultUpdate // CachePutResultMaxItemsExceeded indicates the item was not stored because // the cache's maximum number of items would have been exceeded. CachePutResultMaxItemsExceeded )
type LockPool ¶ added in v1.8.1
LockPool is a synchronized set of maps that can be obtained with a provided ID.
type SelectDeviceFn ¶
type SelectDeviceFn[T vimTypes.BaseVirtualDevice] func(dev vimTypes.BaseVirtualDevice) bool
SelectDeviceFn returns true if the provided virtual device is a match.