vbox

package module
v0.0.0-...-53b8116 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 1, 2017 License: BSD-3-Clause Imports: 6 Imported by: 1

README

vbox

GoDoc

This is a VirtualBox API client for Go, heavily inspired by vboxgo.

The package's API closely mirrors the VirtualBox COM/XPCOM API, so it breaks a lot of Go guidelines. Therefore, most users will prefer using a higher-level library, or building their own abstractions over this library.

This is the author's first piece of Go code, so feedback is welcome.

Usage

The package should build out of a clean checkout. The samples directory contains reasonable starting code for a new library user.

The package generally follows the VirtualBox XPCOM API, meaning that it is rather cumbersome.

Prerequisites

Building this package requires a cgo-enabled Go installation. Most notably, the cgo requirement seems to preclude cross-compilation.

The package dynamically loads VBoxXPCOMC, a library that implements the VirtualBox XPCOM/COM API. The library is included with standard VirtualBox installations.

On systems where VirtualBox is installed at a non-standard location, the VBOX_APP_HOME environment variable must be set to point to the installation location. The following example accomplishes that on 64-bit Fedora.

export VBOX_APP_HOME=/usr/lib64/virtualbox

Testing

Go's standard process for running tests should work, provided that VirtualBox is installed in a standard path, or that VBOX_APP_HOME is set up.

go test

The tests will be really slow the first time around, because they have to download the Lubuntu 15.04 x86 ISO. The massive delay can be avoided by downloading the ISO manually, possibly from a local copy.

wget http://cdimage.ubuntu.com/lubuntu/releases/15.04/release/lubuntu-15.04-desktop-i386.iso
mkdir -p test_tmp
mv lubuntu-15.04-desktop-i386.iso test_tmp/lubuntu-15.04.iso

The dependency on a 700MB image was not taken lightly. We previously tried using TinyCore and Damn Small Linux. Unfortunately, both distributions have a broken mouse setup, which causes failures in the mouse automation tests (mouse_test.go). Suggestions for eliminating the dependency on Lubuntu are welcome.

Debugging

When debugging failing tests, it is useful to start the VBoxSVC process in a console, and inspect its console output. VirtualBox and the API client start the process automatically, but it dies after 5 seconds of inactivity. So, keeping the VirtualBox UI closed for 5 seconds should get rid of the existing process.

The following environment variables enable logging in Release builds of VboxSVC, which are included in the downloadable packages and most distributions. The variables were listed off of the [https://www.virtualbox.org/wiki/VBoxMainLogging](VirtualBox wiki).

export VBOXSVC_RELEASE_LOG=main.e.l.f+gui.e.l.f
export VBOXSVC_RELEASE_LOG_FLAGS="time tid thread"
export VBOXSVC_RELEASE_LOG_DEST=stdout

Vendored VirtualBox SDK

The package contains a subset of the VirtualBox SDK, under third_party/VirtualBoxSDK. The original version was obtained by unzipping the SDK package on the VirtualBox downloads page.

The vendored version removes all the files that are not related to the C bindings, which was necessary to keep the repository small.

The licensing situation of this package is complicated due to issues outside of the author's control. Briefly, you can most likely consider the package to be MIT-licensed.

All files outside of third_party/ are (C) Victor Costan 2015, and made available under the MIT license, which is contained in the LICENSE file.

The vendored VirtualBox has most files (under bindings/c/glue) licensed under the MIT license. However, one header file (under bindings/c/include) is licensed under the LGPL v2.

According to the VirtualBox API developers, the header files do not generate code, so including them should not activate LGPL's viral infection clause. The details are in the forum posts surrounding this post.

Documentation

Overview

Package vbox is a thin wrapper over VirtualBox's COM/XPCOM API. The exposed API follows the COM/XPCOM conventions, and will not feel natural to Go programmers. Most users should look into a higher-level library.

Index

Constants

View Source
const (
	// Open the image file in read-only mode.
	AccessMode_ReadOnly = C.AccessMode_ReadOnly
	// Open the image file in read-write mode.
	AccessMode_ReadWrite = C.AccessMode_ReadWrite
)
View Source
const (
	APICMode_Disabled = C.APICMode_Disabled
	APICMode_APIC     = C.APICMode_APIC
	APICMode_X2APIC   = C.APICMode_X2APIC
)
View Source
const (
	BootMenuMode_Disabled       = C.BIOSBootMenuMode_Disabled
	BootMenuMode_MenuOnly       = C.BIOSBootMenuMode_MenuOnly
	BootMenuMode_MessageAndMenu = C.BIOSBootMenuMode_MessageAndMenu
)
View Source
const (
	// Unregister the machine, do not detach media or delete snapshots.
	CleanupMode_UnregisterOnly = C.CleanupMode_UnregisterOnly
	// Delete snapshots, detach media, do not return any media for closing.
	CleanupMode_DetachAllReturnNone = C.CleanupMode_DetachAllReturnNone
	// Delete snapshots, detach media, return hard disks for closing.
	// This does not return removable media attached to the VM.
	CleanupMode_DetachAllReturnHardDisksOnly = C.CleanupMode_DetachAllReturnHardDisksOnly
	// Delete snapshots, detach media, return all media for closing.
	// This is not recommended by the API documentation, because users generally
	// want to keep their ISOs around.
	CleanupMode_Full = C.CleanupMode_Full
)
View Source
const (
	ClipboardMode_Disabled      = C.ClipboardMode_Disabled
	ClipboardMode_HostToGuest   = C.ClipboardMode_HostToGuest
	ClipboardMode_GuestToHost   = C.ClipboardMode_GuestToHost
	ClipboardMode_Bidirectional = C.ClipboardMode_Bidirectional
)
View Source
const (
	// No device
	DeviceType_Null = C.DeviceType_Null
	// Floppy device
	DeviceType_Floppy = C.DeviceType_Floppy
	// DVD/CD-ROM device
	DeviceType_Dvd = C.DeviceType_DVD
	// Hard disk device
	DeviceType_HardDisk = C.DeviceType_HardDisk
	// Hard disk device
	DeviceType_Network = C.DeviceType_Network
	// Hard disk device
	DeviceType_Usb = C.DeviceType_USB
	// Hard disk device
	DeviceType_SharedFolder = C.DeviceType_SharedFolder
)
View Source
const (
	DnDMode_Disabled      = C.DnDMode_Disabled
	DnDMode_HostToGuest   = C.DnDMode_HostToGuest
	DnDMode_GuestToHost   = C.DnDMode_GuestToHost
	DnDMode_Bidirectional = C.DnDMode_Bidirectional
)
View Source
const (
	EventType_Invalid                                 = C.VBoxEventType_Invalid
	EventType_Any                                     = C.VBoxEventType_Any
	EventType_Vetoable                                = C.VBoxEventType_Vetoable
	EventType_MachineEvent                            = C.VBoxEventType_MachineEvent
	EventType_SnapshotEvent                           = C.VBoxEventType_SnapshotEvent
	EventType_InputEvent                              = C.VBoxEventType_InputEvent
	EventType_LastWildcard                            = C.VBoxEventType_LastWildcard
	EventType_OnMachineStateChanged                   = C.VBoxEventType_OnMachineStateChanged
	EventType_OnMachineDataChanged                    = C.VBoxEventType_OnMachineDataChanged
	EventType_OnExtraDataChanged                      = C.VBoxEventType_OnExtraDataChanged
	EventType_OnExtraDataCanChange                    = C.VBoxEventType_OnExtraDataCanChange
	EventType_OnMediumRegistered                      = C.VBoxEventType_OnMediumRegistered
	EventType_OnMachineRegistered                     = C.VBoxEventType_OnMachineRegistered
	EventType_OnSessionStateChanged                   = C.VBoxEventType_OnSessionStateChanged
	EventType_OnSnapshotTaken                         = C.VBoxEventType_OnSnapshotTaken
	EventType_OnSnapshotDeleted                       = C.VBoxEventType_OnSnapshotDeleted
	EventType_OnSnapshotChanged                       = C.VBoxEventType_OnSnapshotChanged
	EventType_OnGuestPropertyChanged                  = C.VBoxEventType_OnGuestPropertyChanged
	EventType_OnMousePointerShapeChanged              = C.VBoxEventType_OnMousePointerShapeChanged
	EventType_OnMouseCapabilityChanged                = C.VBoxEventType_OnMouseCapabilityChanged
	EventType_OnKeyboardLedsChanged                   = C.VBoxEventType_OnKeyboardLedsChanged
	EventType_OnStateChanged                          = C.VBoxEventType_OnStateChanged
	EventType_OnAdditionsStateChanged                 = C.VBoxEventType_OnAdditionsStateChanged
	EventType_OnNetworkAdapterChanged                 = C.VBoxEventType_OnNetworkAdapterChanged
	EventType_OnSerialPortChanged                     = C.VBoxEventType_OnSerialPortChanged
	EventType_OnParallelPortChanged                   = C.VBoxEventType_OnParallelPortChanged
	EventType_OnStorageControllerChanged              = C.VBoxEventType_OnStorageControllerChanged
	EventType_OnMediumChanged                         = C.VBoxEventType_OnMediumChanged
	EventType_OnVRDEServerChanged                     = C.VBoxEventType_OnVRDEServerChanged
	EventType_OnUSBControllerChanged                  = C.VBoxEventType_OnUSBControllerChanged
	EventType_OnUSBDeviceStateChanged                 = C.VBoxEventType_OnUSBDeviceStateChanged
	EventType_OnSharedFolderChanged                   = C.VBoxEventType_OnSharedFolderChanged
	EventType_OnRuntimeError                          = C.VBoxEventType_OnRuntimeError
	EventType_OnCanShowWindow                         = C.VBoxEventType_OnCanShowWindow
	EventType_OnShowWindow                            = C.VBoxEventType_OnShowWindow
	EventType_OnCPUChanged                            = C.VBoxEventType_OnCPUChanged
	EventType_OnVRDEServerInfoChanged                 = C.VBoxEventType_OnVRDEServerInfoChanged
	EventType_OnEventSourceChanged                    = C.VBoxEventType_OnEventSourceChanged
	EventType_OnCPUExecutionCapChanged                = C.VBoxEventType_OnCPUExecutionCapChanged
	EventType_OnGuestKeyboard                         = C.VBoxEventType_OnGuestKeyboard
	EventType_OnGuestMouse                            = C.VBoxEventType_OnGuestMouse
	EventType_OnNATRedirect                           = C.VBoxEventType_OnNATRedirect
	EventType_OnHostPCIDevicePlug                     = C.VBoxEventType_OnHostPCIDevicePlug
	EventType_OnVBoxSVCAvailabilityChanged            = C.VBoxEventType_OnVBoxSVCAvailabilityChanged
	EventType_OnBandwidthGroupChanged                 = C.VBoxEventType_OnBandwidthGroupChanged
	EventType_OnGuestMonitorChanged                   = C.VBoxEventType_OnGuestMonitorChanged
	EventType_OnStorageDeviceChanged                  = C.VBoxEventType_OnStorageDeviceChanged
	EventType_OnClipboardModeChanged                  = C.VBoxEventType_OnClipboardModeChanged
	EventType_OnDnDModeChanged                        = C.VBoxEventType_OnDnDModeChanged
	EventType_OnNATNetworkChanged                     = C.VBoxEventType_OnNATNetworkChanged
	EventType_OnNATNetworkStartStop                   = C.VBoxEventType_OnNATNetworkStartStop
	EventType_OnNATNetworkAlter                       = C.VBoxEventType_OnNATNetworkAlter
	EventType_OnNATNetworkCreationDeletion            = C.VBoxEventType_OnNATNetworkCreationDeletion
	EventType_OnNATNetworkSetting                     = C.VBoxEventType_OnNATNetworkSetting
	EventType_OnNATNetworkPortForward                 = C.VBoxEventType_OnNATNetworkPortForward
	EventType_OnGuestSessionStateChanged              = C.VBoxEventType_OnGuestSessionStateChanged
	EventType_OnGuestSessionRegistered                = C.VBoxEventType_OnGuestSessionRegistered
	EventType_OnGuestProcessRegistered                = C.VBoxEventType_OnGuestProcessRegistered
	EventType_OnGuestProcessStateChanged              = C.VBoxEventType_OnGuestProcessStateChanged
	EventType_OnGuestProcessInputNotify               = C.VBoxEventType_OnGuestProcessInputNotify
	EventType_OnGuestProcessOutput                    = C.VBoxEventType_OnGuestProcessOutput
	EventType_OnGuestFileRegistered                   = C.VBoxEventType_OnGuestFileRegistered
	EventType_OnGuestFileStateChanged                 = C.VBoxEventType_OnGuestFileStateChanged
	EventType_OnGuestFileOffsetChanged                = C.VBoxEventType_OnGuestFileOffsetChanged
	EventType_OnGuestFileRead                         = C.VBoxEventType_OnGuestFileRead
	EventType_OnGuestFileWrite                        = C.VBoxEventType_OnGuestFileWrite
	EventType_OnVideoCaptureChanged                   = C.VBoxEventType_OnVideoCaptureChanged
	EventType_OnGuestUserStateChanged                 = C.VBoxEventType_OnGuestUserStateChanged
	EventType_OnGuestMultiTouch                       = C.VBoxEventType_OnGuestMultiTouch
	EventType_OnHostNameResolutionConfigurationChange = C.VBoxEventType_OnHostNameResolutionConfigurationChange
	EventType_OnSnapshotRestored                      = C.VBoxEventType_OnSnapshotRestored
	EventType_OnMediumConfigChanged                   = C.VBoxEventType_OnMediumConfigChanged
	EventType_Last                                    = C.VBoxEventType_Last
)
View Source
const (
	// Shared lock that can be used to read the VM settings.
	LockType_Shared = C.LockType_Shared
	// Exclusive lock needed to change VM settings or start it.
	LockType_Write = C.LockType_Write
)
View Source
const (
	MachineState_Null                   = C.MachineState_Null
	MachineState_PoweredOff             = C.MachineState_PoweredOff
	MachineState_Saved                  = C.MachineState_Saved
	MachineState_Teleported             = C.MachineState_Teleported
	MachineState_Aborted                = C.MachineState_Aborted
	MachineState_Running                = C.MachineState_Running
	MachineState_Paused                 = C.MachineState_Paused
	MachineState_Stuck                  = C.MachineState_Stuck
	MachineState_Teleporting            = C.MachineState_Teleporting
	MachineState_LiveSnapshotting       = C.MachineState_LiveSnapshotting
	MachineState_Starting               = C.MachineState_Starting
	MachineState_Stopping               = C.MachineState_Stopping
	MachineState_Saving                 = C.MachineState_Saving
	MachineState_Restoring              = C.MachineState_Restoring
	MachineState_TeleportingPausedVM    = C.MachineState_TeleportingPausedVM
	MachineState_TeleportingIn          = C.MachineState_TeleportingIn
	MachineState_FaultTolerantSyncing   = C.MachineState_FaultTolerantSyncing
	MachineState_DeletingSnapshotOnline = C.MachineState_DeletingSnapshotOnline
	MachineState_DeletingSnapshotPaused = C.MachineState_DeletingSnapshotPaused
	MachineState_OnlineSnapshotting     = C.MachineState_OnlineSnapshotting
	MachineState_RestoringSnapshot      = C.MachineState_RestoringSnapshot
	MachineState_DeletingSnapshot       = C.MachineState_DeletingSnapshot
	MachineState_SettingUp              = C.MachineState_SettingUp
	MachineState_Snapshotting           = C.MachineState_Snapshotting
	MachineState_FirstOnline            = C.MachineState_FirstOnline
	MachineState_LastOnline             = C.MachineState_LastOnline
	MachineState_FirstTransient         = C.MachineState_FirstTransient
	MachineState_LastTransient          = C.MachineState_LastTransient
)
View Source
const (
	// The medium's backing image was not created or was deleted.
	MediumState_NotCreated = C.MediumState_NotCreated
	// The medium's backing image was not created or was deleted.
	MediumState_Created = C.MediumState_Created
	// The medium's backing image is locked with a shared reader lock.
	MediumState_LockedRead = C.MediumState_LockedRead
	// The medium's backing image is locked with an exclusive writer lock.
	MediumState_LockedWrite = C.MediumState_LockedWrite
	// The medium's backing image cannot / was not accessed.
	MediumState_Inaccessible = C.MediumState_Inaccessible
	// The medium's backing image is being built.
	MediumState_Creating = C.MediumState_Creating
	// The medium's backing image is being deleted.
	MediumState_Deleting = C.MediumState_Deleting
)
View Source
const (
	// No button is pressed.
	MouseButtonState_None         = 0
	MouseButtonState_LeftButton   = C.MouseButtonState_LeftButton
	MouseButtonState_RightButton  = C.MouseButtonState_RightButton
	MouseButtonState_MiddleButton = C.MouseButtonState_MiddleButton
	MouseButtonState_WheelUp      = C.MouseButtonState_WheelUp
	MouseButtonState_WheelDown    = C.MouseButtonState_WheelDown
	MouseButtonState_XButton1     = C.MouseButtonState_XButton1
	MouseButtonState_XButton2     = C.MouseButtonState_XButton2
)
View Source
const (
	NetworkAdapterType_Null      = C.NetworkAdapterType_Null
	NetworkAdapterType_Am79C970A = C.NetworkAdapterType_Am79C970A
	NetworkAdapterType_Am79C973  = C.NetworkAdapterType_Am79C973
	NetworkAdapterType_I82540EM  = C.NetworkAdapterType_I82540EM
	NetworkAdapterType_I82543GC  = C.NetworkAdapterType_I82543GC
	NetworkAdapterType_I82545EM  = C.NetworkAdapterType_I82545EM
	NetworkAdapterType_Virtio    = C.NetworkAdapterType_Virtio
)
View Source
const (
	NetworkAttachmentType_Null       = C.NetworkAttachmentType_Null
	NetworkAttachmentType_NAT        = C.NetworkAttachmentType_NAT
	NetworkAttachmentType_Bridged    = C.NetworkAttachmentType_Bridged
	NetworkAttachmentType_Internal   = C.NetworkAttachmentType_Internal
	NetworkAttachmentType_HostOnly   = C.NetworkAttachmentType_HostOnly
	NetworkAttachmentType_Generic    = C.NetworkAttachmentType_Generic
	NetworkAttachmentType_NATNetwork = C.NetworkAttachmentType_NATNetwork
)
View Source
const (
	// No mouse
	PointingHidType_None = C.PointingHIDType_None
	// PS/2 mouse
	PointingHidType_Ps2Mouse = C.PointingHIDType_PS2Mouse
	// USB mouse (relative pointer)
	PointingHidType_UsbMouse = C.PointingHIDType_USBMouse
	// USB tablet (absolute pointer)
	PointingHidType_UsbTablet = C.PointingHIDType_USBTablet
	// Combo PS2/2 or USB mouse, depending on guest (negative perf implications)
	PointingHidType_ComboMouse = C.PointingHIDType_ComboMouse
	// USB multi-touch device
	// This also adds USB tablet and mouse devices.
	PointingHidType_UsbMultiTouch = C.PointingHIDType_USBMultiTouch
)
View Source
const (
	// Null value that is never used by the API
	StorageBus_Null   = C.StorageBus_Null
	StorageBus_Ide    = C.StorageBus_IDE
	StorageBus_Sata   = C.StorageBus_SATA
	StorageBus_Scsi   = C.StorageBus_SCSI
	StorageBus_Floppy = C.StorageBus_Floppy
	StorageBus_Sas    = C.StorageBus_SAS
)
View Source
const (
	// Null value that is never used by the API
	SessionState_Null = C.SessionState_Null
	// The session / machine is not locked.
	SessionState_Unlocked = C.SessionState_Unlocked
	// The session / machine is locked.
	SessionState_Locked = C.SessionState_Locked
	// Transient state while a VM is locked and started.
	SessionState_Spawning = C.SessionState_Spawning
	// The session is getting unlocked.
	SessionState_Unlocking = C.SessionState_Unlocking
)
View Source
const (
	// Null value that is never used by the API
	SessionType_Null = C.SessionType_Null
	// The session has an exclusive lock on a VM.
	SessionType_WriteLock = C.SessionType_WriteLock
	// The session has launched a VM process.
	SessionType_Remote = C.SessionType_Remote
	// The session has a shared lock on a VM.
	SessionType_Shared = C.SessionType_Shared
)
View Source
const (
	// Null value that is never used by the API
	StorageControllerType_Null = C.StorageControllerType_Null
	// SCSI controller of the LsiLogic variant
	StorageControllerType_LsiLogic = C.StorageControllerType_LsiLogic
	// SCSI controller of the BusLogic variant
	StorageControllerType_BusLogic = C.StorageControllerType_BusLogic
	// The only SATA controller available
	StorageControllerType_IntelAhci = C.StorageControllerType_IntelAhci
	// IDE controller of the PIIX3 variant
	StorageControllerType_Piix3 = C.StorageControllerType_PIIX3
	// IDE controller of the PIIX4 variant
	StorageControllerType_Piix4 = C.StorageControllerType_PIIX4
	// IDE controller of the ICH6 variant
	StorageControllerType_Ich6 = C.StorageControllerType_ICH6
	// The only floppy drive controller available
	StorageControllerType_I82078 = C.StorageControllerType_I82078
	// LsiLogic SCSI controller that uses SAS
	StorageControllerType_LsiLogicSas = C.StorageControllerType_LsiLogicSas
)
View Source
const (
	// Null value that is never used by the API
	UsbControllerType_Null = C.USBControllerType_Null
	// USB 1.1 controller available in the free VirtualBox edition
	UsbControllerType_Ohci = C.USBControllerType_OHCI
	// USB 2.0 controller that requires the extension pack
	UsbControllerType_Ehci = C.USBControllerType_EHCI
)

Variables

View Source
var ApiVersion uint = 0
View Source
var AppVersion uint = 0

Functions

func ComposeMachineFilename

func ComposeMachineFilename(
	name string, flags string, baseFolder string) (string, error)

ComposeMachineFilename returns a default VM config file path. If baseFolder is empty, VirtualBox's default machine folder will be used. It returns a string and any error encountered.

func Deinit

func Deinit() error

Deinit cleans up the VirtualBox global state. After this method is called, all VirtualBox-related objects are invalid. It returns any error encountered.

func GetRevision

func GetRevision() (int, error)

GetRevision returns VirtualBox's SVN revision as a number.

func Init

func Init() error

Init initializes the VirtualBox global data structures.

Due to VirtualBox oddness, Init should ideally be called in the application's main thread. The odds of this happening are maximized by calling Init() from the application's main goroutine.

It returns any error encountered.

func SetExtraData

func SetExtraData(key string, value string) error

Types

type APICMode

type APICMode uint

Enumeration of APICMode values

type AccessMode

type AccessMode uint

Enumeration of AccessMode values

type AudioAdapter

type AudioAdapter struct {
	// contains filtered or unexported fields
}

The description of a audio adapter

func (*AudioAdapter) Release

func (a *AudioAdapter) Release() error

Release frees up the associated VirtualBox data. After the call, this instance is invalid, and using it will cause errors. It returns any error encountered.

type BiosSettings

type BiosSettings struct {
	// contains filtered or unexported fields
}

Controls a running VM.

func (*BiosSettings) GetACPIEnabled

func (settings *BiosSettings) GetACPIEnabled() (bool, error)

func (*BiosSettings) GetAPICMode

func (settings *BiosSettings) GetAPICMode() (APICMode, error)

func (*BiosSettings) GetBootMenuMode

func (settings *BiosSettings) GetBootMenuMode() (BootMenuMode, error)

GetBootMenuMode returns true if the BIOS logo fades out during boot. It returns a boolean and any error encountered.

func (*BiosSettings) GetIOAPICEnabled

func (settings *BiosSettings) GetIOAPICEnabled() (bool, error)

func (*BiosSettings) GetLogoDisplayTime

func (settings *BiosSettings) GetLogoDisplayTime() (time.Duration, error)

func (*BiosSettings) GetLogoFadeIn

func (settings *BiosSettings) GetLogoFadeIn() (bool, error)

GetLogoFadeIn returns true if the BIOS logo fades in during boot. It returns a boolean and any error encountered.

func (*BiosSettings) GetLogoFadeOut

func (settings *BiosSettings) GetLogoFadeOut() (bool, error)

GetLogoFadeOut returns true if the BIOS logo fades out during boot. It returns a boolean and any error encountered.

func (*BiosSettings) GetLogoImagePath

func (settings *BiosSettings) GetLogoImagePath() (string, error)

func (*BiosSettings) GetPXEDebugEnabled

func (settings *BiosSettings) GetPXEDebugEnabled() (bool, error)

func (*BiosSettings) GetTimeOffset

func (settings *BiosSettings) GetTimeOffset() (time.Duration, error)

func (*BiosSettings) Initialized

func (settings *BiosSettings) Initialized() bool

Initialized returns true if there is VirtualBox data associated with this.

func (*BiosSettings) Release

func (settings *BiosSettings) Release() error

Release frees up the associated VirtualBox data. After the call, this instance is invalid, and using it will cause errors. It returns any error encountered.

func (*BiosSettings) SetACPIEnabled

func (settings *BiosSettings) SetACPIEnabled(acpiEnabled bool) error

func (*BiosSettings) SetAPICMode

func (settings *BiosSettings) SetAPICMode(apicMode APICMode) error

func (*BiosSettings) SetBootMenuMode

func (settings *BiosSettings) SetBootMenuMode(menuMode BootMenuMode) error

SetBootMenuMode sets whether the BIOS logo fades out during boot. It any error encountered.

func (*BiosSettings) SetIOAPICEnabled

func (settings *BiosSettings) SetIOAPICEnabled(ioapicEnabled bool) error

func (*BiosSettings) SetLogoDisplayTime

func (settings *BiosSettings) SetLogoDisplayTime(displayTime time.Duration) error

func (*BiosSettings) SetLogoFadeIn

func (settings *BiosSettings) SetLogoFadeIn(logoFadeIn bool) error

SetLogoFadeIn sets whether the BIOS logo fades in during boot. It any error encountered.

func (*BiosSettings) SetLogoFadeOut

func (settings *BiosSettings) SetLogoFadeOut(logoFadeOut bool) error

SetLogoFadeOut sets whether the BIOS logo fades out during boot. It any error encountered.

func (*BiosSettings) SetLogoImagePath

func (settings *BiosSettings) SetLogoImagePath(logoImagePath string) error

func (*BiosSettings) SetPXEDebugEnabled

func (settings *BiosSettings) SetPXEDebugEnabled(PXEDebugEnabled bool) error

func (*BiosSettings) SetTimeOffset

func (settings *BiosSettings) SetTimeOffset(timeOffset time.Duration) error

type BootMenuMode

type BootMenuMode uint

Enumeration of BIOSBootMenuMode values

type CleanupMode

type CleanupMode uint

Enumeration of CleanupMode values

type ClipboardMode

type ClipboardMode uint

type Console

type Console struct {
	// contains filtered or unexported fields
}

Controls a running VM.

func (*Console) GetDisplay

func (console *Console) GetDisplay() (Display, error)

GetDisplay obtains the display of the VM controlled by this. It returns a new Display instance and any error encountered.

func (*Console) GetEventSource

func (console *Console) GetEventSource() (EventSource, error)

func (*Console) GetKeyboard

func (console *Console) GetKeyboard() (Keyboard, error)

GetKeyboard obtains the keyboard of the VM controlled by this. It returns a new Keyboard instance and any error encountered.

func (*Console) GetMachine

func (console *Console) GetMachine() (Machine, error)

GetMachine obtains the VM associated with this set of VM controls. It returns a new Machine instance and any error encountered.

func (*Console) GetMouse

func (console *Console) GetMouse() (Mouse, error)

GetMouse obtains the mouse of the VM controlled by this. It returns a new Mouse instance and any error encountered.

func (*Console) Initialized

func (console *Console) Initialized() bool

Initialized returns true if there is VirtualBox data associated with this.

func (*Console) PowerDown

func (console *Console) PowerDown() (Progress, error)

PowerDown starts forcibly powering off the controlled VM. It returns a Progress and any error encountered.

func (*Console) PowerUp

func (console *Console) PowerUp() (Progress, error)

func (*Console) Release

func (console *Console) Release() error

Release frees up the associated VirtualBox data. After the call, this instance is invalid, and using it will cause errors. It returns any error encountered.

type DeviceType

type DeviceType uint

Enumeration of DeviceType values

type Display

type Display struct {
	// contains filtered or unexported fields
}

The display of a running VM.

func (*Display) GetScreenResolution

func (display *Display) GetScreenResolution(screenId uint,
	resolution *Resolution) error

GetScreenResolution reads the VM display's resolution. It returns any error encountered.

func (*Display) Initialized

func (display *Display) Initialized() bool

Initialized returns true if there is VirtualBox data associated with this.

func (*Display) Release

func (display *Display) Release() error

Release frees up the associated VirtualBox data. After the call, this instance is invalid, and using it will cause errors. It returns any error encountered.

func (*Display) TakeScreenShot

func (display *Display) TakeScreenShot(screenId uint, imageData []byte,
	width uint, height uint, bitmapFormat uint) ([]byte, error)

TakeScreenShot takes a screenshot of the VM's display. The slice passed in must be big enough to receive the image data, which is RGBA (4 bytes per pixel). It returns any error encountered.

func (*Display) TakeScreenShotPngToArray

func (display *Display) TakeScreenShotPngToArray(screenId uint,
	width uint, height uint) ([]byte, error)

TakeScreenShotPNGToArray takes a screenshot of the VM's display. It returns a byte slice encoding the image as PNG, and any error encountered.

func (*Display) TakeScreenShotToArray

func (display *Display) TakeScreenShotToArray(screenId uint,
	width uint, height uint) ([]byte, error)

TakeScreenShotToArray takes a screenshot of the VM's display. It returns a byte slice encoding the image as RGBA, and any error encountered.

type DnDMode

type DnDMode uint

type Event

type Event struct {
	// contains filtered or unexported fields
}

The description of a VirtualBox machine

func (*Event) GetSource

func (event *Event) GetSource() (EventSource, error)

func (*Event) GetType

func (event *Event) GetType() (uint32, error)

func (*Event) GetWaitable

func (event *Event) GetWaitable() (bool, error)

func (*Event) Release

func (event *Event) Release() error

Release frees up the associated VirtualBox data. After the call, this instance is invalid, and using it will cause errors. It returns any error encountered.

func (*Event) SetProcessed

func (event *Event) SetProcessed() error

func (*Event) WaitProcessed

func (event *Event) WaitProcessed(timeout int32) (bool, error)

type EventListener

type EventListener struct {
	// contains filtered or unexported fields
}

The description of a VirtualBox machine

func (*EventListener) Release

func (eventListener *EventListener) Release() error

Release frees up the associated VirtualBox data. After the call, this instance is invalid, and using it will cause errors. It returns any error encountered.

type EventSource

type EventSource struct {
	// contains filtered or unexported fields
}

The description of a VirtualBox machine

func (*EventSource) CreateAggregator

func (eventSource *EventSource) CreateAggregator(subordinates []EventSource) (EventSource, error)

func (*EventSource) CreateListener

func (eventSource *EventSource) CreateListener() (EventListener, error)

func (*EventSource) EventProcessed

func (eventSource *EventSource) EventProcessed(eventListener EventListener,
	event Event) error

func (*EventSource) FireEvent

func (eventSource *EventSource) FireEvent(eventListener EventListener,
	event Event, timeout int32) (bool, error)

func (*EventSource) GetEvent

func (eventSource *EventSource) GetEvent(eventListener EventListener,
	timeout int32) (*Event, error)

func (*EventSource) RegisterListener

func (eventSource *EventSource) RegisterListener(eventListener EventListener,
	interesting []uint32, active bool) error

func (*EventSource) Release

func (eventSource *EventSource) Release() error

Release frees up the associated VirtualBox data. After the call, this instance is invalid, and using it will cause errors. It returns any error encountered.

func (*EventSource) UnregisterListener

func (eventSource *EventSource) UnregisterListener(eventListener EventListener) error

type EventType

type EventType uint

Enumeration of VBoxEventType values

type GuestOsType

type GuestOsType struct {
	// contains filtered or unexported fields
}

The description of a supported guest OS type

func GetGuestOsTypes

func GetGuestOsTypes() ([]GuestOsType, error)

GetGuestOsTypes returns the guest OS types supported by VirtualBox. It returns a slice of GuestOsType instances and any error encountered.

func (*GuestOsType) GetId

func (osType *GuestOsType) GetId() (string, error)

GetId returns the string used to identify this OS type in other API calls. It returns a string and any error encountered.

func (*GuestOsType) Initialized

func (osType *GuestOsType) Initialized() bool

Initialized returns true if there is VirtualBox data associated with this.

func (*GuestOsType) Release

func (osType *GuestOsType) Release() error

Release frees up the associated VirtualBox data. After the call, this instance is invalid, and using it will cause errors. It returns any error encountered.

type GuestProperty

type GuestProperty struct {
	Name      string
	Value     string
	Flags     string
	Timestamp int64
}

type GuestPropertyChangedEvent

type GuestPropertyChangedEvent struct {
	Event
	// contains filtered or unexported fields
}

func NewGuestPropertyChangedEvent

func NewGuestPropertyChangedEvent(event *Event) (GuestPropertyChangedEvent, error)

func (*GuestPropertyChangedEvent) GetFlags

func (event *GuestPropertyChangedEvent) GetFlags() (string, error)

func (*GuestPropertyChangedEvent) GetName

func (event *GuestPropertyChangedEvent) GetName() (string, error)

func (*GuestPropertyChangedEvent) GetValue

func (event *GuestPropertyChangedEvent) GetValue() (string, error)

type Keyboard

type Keyboard struct {
	// contains filtered or unexported fields
}

The keyboard of a running VM.

func (*Keyboard) Initialized

func (keyboard *Keyboard) Initialized() bool

Initialized returns true if there is VirtualBox data associated with this.

func (*Keyboard) PutScancodes

func (keyboard *Keyboard) PutScancodes(scancodes []int) (uint, error)

PutScancodes posts keyboard scancodes to the guest OS event queue. It returns any error encountered.

func (*Keyboard) Release

func (keyboard *Keyboard) Release() error

Release frees up the associated VirtualBox data. After the call, this instance is invalid, and using it will cause errors. It returns any error encountered.

type LockType

type LockType uint

type Machine

type Machine struct {
	// contains filtered or unexported fields
}

The description of a VirtualBox machine

func CreateMachine

func CreateMachine(
	settings string, name string, osTypeId string, flags string) (Machine, error)

CreateMachine creates a VirtualBox machine. The machine must be registered by calling Register before it shows up in the GetMachines list. Flags is comma-separated. The most interesting flag is forceOverwrite=1. It returns the created machine and any error encountered.

func FindMachine

func FindMachine(nameOrId string) (Machine, error)

FindMachine returns the VirtualBox machine with the given name. It returns a new Machine instance and any error encountered.

func GetMachines

func GetMachines() ([]Machine, error)

GetMachines returns the machines known to VirtualBox. It returns a slice of Machine instances and any error encountered.

func (*Machine) AddStorageController

func (machine *Machine) AddStorageController(
	name string, connectionType StorageBus) (StorageController, error)

AddStorageController attaches a storage controller to a VirtualBox VM. It returns the created StorageController and any error encountered.

func (*Machine) AddUsbController

func (machine *Machine) AddUsbController(
	name string, controllerType UsbControllerType) (UsbController, error)

AddUsbController attaches a storage controller to a VirtualBox VM. It returns the created UsbController and any error encountered.

func (*Machine) AttachDevice

func (machine *Machine) AttachDevice(controllerName string, controllerPort int,
	deviceSlot int, deviceType DeviceType, medium Medium) error

AttachDevice connects a Medium to this VM. deviceSlot is 0 for IDE master and 1 for IDE slave. All other bus types use deviceSlot 0. It returns any error encountered.

func (*Machine) CreateSharedFolder

func (machine *Machine) CreateSharedFolder(name string, hostPath string, writable bool, automount bool) error

func (*Machine) DeleteConfig

func (machine *Machine) DeleteConfig(media []Medium) (Progress, error)

DeleteConfig removes a VM's config file, and can remove its disk images. The Medium array is intended to be obtained from a previous Unregister call. It returns a Progress instance and any error encountered.

func (*Machine) DeleteGuestProperty

func (machine *Machine) DeleteGuestProperty(key string) error

func (*Machine) DetachDevice

func (machine *Machine) DetachDevice(controllerName string, controllerPort int,
	deviceSlot int) error

DetachDevice disconnects a Medium from this VM. deviceSlot is 0 for IDE master and 1 for IDE slave. All other bus types use deviceSlot 0. It returns any error encountered.

func (*Machine) EnumerateGuestProperties

func (machine *Machine) EnumerateGuestProperties(pattern string) ([]GuestProperty, error)

func (*Machine) GetAccelerate2DVideoEnabled

func (machine *Machine) GetAccelerate2DVideoEnabled() (bool, error)

func (*Machine) GetAccelerate3DEnabled

func (machine *Machine) GetAccelerate3DEnabled() (bool, error)

func (*Machine) GetAudioAdapter

func (machine *Machine) GetAudioAdapter() (AudioAdapter, error)

func (*Machine) GetBiosSettings

func (machine *Machine) GetBiosSettings() (BiosSettings, error)

GetBiosSettings obtains the controls for the VM associated with this machine. The call fails unless the VM associated with this machine has started. It returns a new BiosSettings instance and any error encountered.

func (*Machine) GetCPUCount

func (machine *Machine) GetCPUCount() (uint, error)

func (*Machine) GetClipboardMode

func (machine *Machine) GetClipboardMode() (ClipboardMode, error)

func (*Machine) GetDnDMode

func (machine *Machine) GetDnDMode() (DnDMode, error)

func (*Machine) GetGuestProperty

func (machine *Machine) GetGuestProperty(key string) (string, int, string, error)

func (*Machine) GetGuestPropertyValue

func (machine *Machine) GetGuestPropertyValue(key string) (string, error)

func (*Machine) GetMedium

func (machine *Machine) GetMedium(controllerName string, controllerPort int,
	deviceSlot int) (Medium, error)

GetMedium returns a Medium connected to this VM. It returns the requested Medium and any error encountered.

func (*Machine) GetMemorySize

func (machine *Machine) GetMemorySize() (uint, error)

GetMemorySize returns the machine's emulated mouse type. It returns a number and any error encountered.

func (*Machine) GetName

func (machine *Machine) GetName() (string, error)

GetName returns the machine's name. It returns a string and any error encountered.

func (*Machine) GetNetworkAdapter

func (machine *Machine) GetNetworkAdapter(deviceSlot int) (NetworkAdapter, error)

func (*Machine) GetOsTypeId

func (machine *Machine) GetOsTypeId() (string, error)

GetOsTypeId returns a string used to identify the guest OS type. It returns a string and any error encountered.

func (*Machine) GetPointingHidType

func (machine *Machine) GetPointingHidType() (PointingHidType, error)

GetPointingHidType returns the machine's emulated mouse type. It returns a number and any error encountered.

func (*Machine) GetSettingsFilePath

func (machine *Machine) GetSettingsFilePath() (string, error)

GetSettingsFilePath returns the path of the machine's settings file. It returns a string and any error encountered.

func (*Machine) GetSettingsModified

func (machine *Machine) GetSettingsModified() (bool, error)

GetSettingsModified asks VirtualBox if this machine has unsaved settings. It returns a boolean and any error encountered.

func (*Machine) GetState

func (machine *Machine) GetState() (uint, error)

func (*Machine) GetVramSize

func (machine *Machine) GetVramSize() (uint, error)

GetVramSize returns the machine's emulated mouse type. It returns a number and any error encountered.

func (*Machine) Initialized

func (machine *Machine) Initialized() bool

Initialized returns true if there is VirtualBox data associated with this.

func (*Machine) Launch

func (machine *Machine) Launch(session Session, uiType string,
	environment string) (Progress, error)

Launch swapns a process that executes this VM. The given session will receive a shared lock on the VM. It returns a Progress and any error encountered.

func (*Machine) Register

func (machine *Machine) Register() error

Register adds this to VirtualBox's list of registered machines. Once a VM is registered, it becomes immutable. Its configuration can only be changed by creating a Session, LockMachine-ing the machine to the session, and obtaining the Session's version of the machine via GetMachine. It returns any error encountered.

func (*Machine) Release

func (machine *Machine) Release() error

Release frees up the associated VirtualBox data. After the call, this instance is invalid, and using it will cause errors. It returns any error encountered.

func (*Machine) RemoveSharedFolder

func (machine *Machine) RemoveSharedFolder(name string) error

func (*Machine) SaveSettings

func (machine *Machine) SaveSettings() error

SaveSettings saves a machine's modified settings. A new machine must have its settings saved before it can be registered. It returns a boolean and any error encountered.

func (*Machine) SetAccelerate2DVideoEnabled

func (machine *Machine) SetAccelerate2DVideoEnabled(enabled bool) error

func (*Machine) SetAccelerate3DEnabled

func (machine *Machine) SetAccelerate3DEnabled(enabled bool) error

func (*Machine) SetCPUCount

func (machine *Machine) SetCPUCount(cpus uint) error

func (*Machine) SetClipboardMode

func (machine *Machine) SetClipboardMode(mode ClipboardMode) error

func (*Machine) SetDnDMode

func (machine *Machine) SetDnDMode(mode DnDMode) error

func (*Machine) SetExtraData

func (machine *Machine) SetExtraData(key string, value string) error

func (*Machine) SetGuestProperty

func (machine *Machine) SetGuestProperty(key string, value string, flags string) error

func (*Machine) SetGuestPropertyValue

func (machine *Machine) SetGuestPropertyValue(key string, value string) error

func (*Machine) SetMemorySize

func (machine *Machine) SetMemorySize(ram uint) error

SetMemorySize changes the machine's emulated mouse type. It returns a number and any error encountered.

func (*Machine) SetPointingHidType

func (machine *Machine) SetPointingHidType(
	pointingHidType PointingHidType) error

SetPointingHidType changes the machine's emulated mouse type. It returns a number and any error encountered.

func (*Machine) SetSettingsFilePath

func (machine *Machine) SetSettingsFilePath(path string) (Progress, error)

func (*Machine) SetVramSize

func (machine *Machine) SetVramSize(vram uint) error

SetVramSize changes the machine's emulated mouse type. It returns a number and any error encountered.

func (*Machine) UnmountMedium

func (machine *Machine) UnmountMedium(controllerName string,
	controllerPort int, deviceSlot int, force bool) error

UnmountMedium ejects a removable Medium from this VM. It returns any error encountered.

func (*Machine) Unregister

func (machine *Machine) Unregister(cleanupMode CleanupMode) ([]Medium, error)

Unregister removes this from VirtualBox's list of registered machines. The returned slice of Medium instances is intended to be passed to DeleteConfig to get all the VM's files cleaned. It returns an array of detached Medium instances and any error encountered.

type MachineState

type MachineState uint

Enumeration of MediumState values

type Medium

type Medium struct {
	// contains filtered or unexported fields
}

The description of a VirtualBox storage medium

func CreateHardDisk

func CreateHardDisk(formatId string, location string) (Medium, error)

CreateHardDisk creates a VirtualBox storage medium for a hard disk image. The disk's contents must be created by calling createBaseStorage. It returns the created Medium and any error encountered.

func OpenMedium

func OpenMedium(location string, deviceType DeviceType, accessMode AccessMode,
	forceNewUuid bool) (Medium, error)

OpenMedium opens an image backing a VirtualBox storage medium. It returns the newly opened Medium and any error encountered.

func (*Medium) Close

func (medium *Medium) Close() error

Close removes the bond between the Medium object and the image backing it. After this call, the Medium instance should be released, as any calls involving it will error out. The image file is not deleted, so it can be bound to a new Medium by calling OpenMedium. It returns any error encountered.

func (*Medium) CreateBaseStorage

func (medium *Medium) CreateBaseStorage(
	size uint64, variants []MediumVariant) (Progress, error)

CreateBaseStorage starts building a hard disk image. It returns a Progress and any error encountered.

func (*Medium) DeleteStorage

func (medium *Medium) DeleteStorage() (Progress, error)

DeleteStorage starts deleting the image backing a storage medium. It returns a Progress and any error encountered.

func (*Medium) GetLocation

func (medium *Medium) GetLocation() (string, error)

GetLocation returns the path to the image file backing the storage medium. It returns a string and any error encountered.

func (*Medium) GetSize

func (medium *Medium) GetSize() (int64, error)

GetSize returns the actual size of the image backing the medium. The returned size can be smaller than the logical size for dynamically grown images. It returns a byte quantity and any error encountered.

func (*Medium) GetState

func (medium *Medium) GetState() (MediumState, error)

GetState returns the last known medium state. It returns a MediumState enum instance and any error encountered.

func (*Medium) Initialized

func (medium *Medium) Initialized() bool

Initialized returns true if there is VirtualBox data associated with this.

func (*Medium) Release

func (medium *Medium) Release() error

Release frees up the associated VirtualBox data. After the call, this instance is invalid, and using it will cause errors. It returns any error encountered.

type MediumFormat

type MediumFormat struct {
	// contains filtered or unexported fields
}

The description of a supported storage medium format

func (*MediumFormat) GetId

func (format *MediumFormat) GetId() (string, error)

GetId returns the string used to identify this format in other API calls. It returns a string and any error encountered.

func (*MediumFormat) Initialized

func (format *MediumFormat) Initialized() bool

Initialized returns true if there is VirtualBox data associated with this.

func (*MediumFormat) Release

func (format *MediumFormat) Release() error

Release frees up the associated VirtualBox data. After the call, this instance is invalid, and using it will cause errors. It returns any error encountered.

type MediumState

type MediumState uint

Enumeration of MediumState values

type MediumVariant

type MediumVariant uint

Enumeration of MediumVariant values

const (
	// Default image options.
	MediumVariant_Standard MediumVariant = C.MediumVariant_Standard
	// Entire image is allocated at creation time.
	MediumVariant_Fixed MediumVariant = C.MediumVariant_Fixed
	// The image's directory is not created.
	MediumVariant_NoCreateDir MediumVariant = C.MediumVariant_NoCreateDir
)

type Mouse

type Mouse struct {
	// contains filtered or unexported fields
}

The mouse of a running VM.

func (*Mouse) GetAbsoluteSupported

func (mouse *Mouse) GetAbsoluteSupported() (bool, error)

GetAbsoluteSupported checks if the guest handles absolute mouse positioning. If it returns false, PutEventAbsolute() is a no-op. It returns a number and any error encountered.

func (*Mouse) GetRelativeSupported

func (mouse *Mouse) GetRelativeSupported() (bool, error)

GetRelativeSupported checks if the guest handles relative mouse positioning. If it returns false, PutEvent() is a no-op. It returns a number and any error encountered.

func (*Mouse) Initialized

func (mouse *Mouse) Initialized() bool

Initialized returns true if there is VirtualBox data associated with this.

func (*Mouse) PutEvent

func (mouse *Mouse) PutEvent(dx int, dy int, dz int, dw int,
	buttonState MouseButtonState) error

PutEvent posts a mouse event to the guest OS event queue. dz represents vertical mouse wheel moves (rotations), with positive numbers for clockwise rotations. dw represents horizontal mouse wheel moves, with positive numbers for movements to the left. It returns any error encountered.

func (*Mouse) PutEventAbsolute

func (mouse *Mouse) PutEventAbsolute(x int, y int, dz int, dw int,
	buttonState MouseButtonState) error

PutEventAbsolute posts a mouse event to the guest OS event queue. dz represents vertical mouse wheel moves (rotations), with positive numbers for clockwise rotations. dw represents horizontal mouse wheel moves, with positive numbers for movements to the left. It returns any error encountered.

func (*Mouse) Release

func (mouse *Mouse) Release() error

Release frees up the associated VirtualBox data. After the call, this instance is invalid, and using it will cause errors. It returns any error encountered.

type MouseButtonState

type MouseButtonState uint

Enumeration of MouseButtonState values

type NetworkAdapter

type NetworkAdapter struct {
	// contains filtered or unexported fields
}

The description of a VirtualBox machine

func (*NetworkAdapter) GetAdapterType

func (adapter *NetworkAdapter) GetAdapterType() (NetworkAdapterType, error)

func (*NetworkAdapter) GetAttachmentType

func (adapter *NetworkAdapter) GetAttachmentType() (NetworkAttachmentType, error)

func (*NetworkAdapter) GetBridgeInterface

func (adapter *NetworkAdapter) GetBridgeInterface() (string, error)

func (*NetworkAdapter) GetCableConnected

func (adapter *NetworkAdapter) GetCableConnected() (bool, error)

func (*NetworkAdapter) GetEnabled

func (adapter *NetworkAdapter) GetEnabled() (bool, error)

func (*NetworkAdapter) GetGenericDriver

func (adapter *NetworkAdapter) GetGenericDriver() (string, error)

func (*NetworkAdapter) GetHostOnlyInterface

func (adapter *NetworkAdapter) GetHostOnlyInterface() (string, error)

func (*NetworkAdapter) GetInternalNetwork

func (adapter *NetworkAdapter) GetInternalNetwork() (string, error)

func (*NetworkAdapter) GetMACAddress

func (adapter *NetworkAdapter) GetMACAddress() (string, error)

func (*NetworkAdapter) GetNATNetwork

func (adapter *NetworkAdapter) GetNATNetwork() (string, error)

func (*NetworkAdapter) GetSlot

func (adapter *NetworkAdapter) GetSlot() (uint, error)

func (*NetworkAdapter) Release

func (adapter *NetworkAdapter) Release() error

Release frees up the associated VirtualBox data. After the call, this instance is invalid, and using it will cause errors. It returns any error encountered.

func (*NetworkAdapter) SetAdapterType

func (adapter *NetworkAdapter) SetAdapterType(adapterType NetworkAdapterType) error

func (*NetworkAdapter) SetAttachmentType

func (adapter *NetworkAdapter) SetAttachmentType(attachmentType NetworkAttachmentType) error

func (*NetworkAdapter) SetBridgedInterface

func (adapter *NetworkAdapter) SetBridgedInterface(bridgedInterface string) error

func (*NetworkAdapter) SetCableConnected

func (adapter *NetworkAdapter) SetCableConnected(cableConnected bool) error

func (*NetworkAdapter) SetEnabled

func (adapter *NetworkAdapter) SetEnabled(enabled bool) error

func (*NetworkAdapter) SetGenericDriver

func (adapter *NetworkAdapter) SetGenericDriver(genericDriver string) error

func (*NetworkAdapter) SetHostOnlyInterface

func (adapter *NetworkAdapter) SetHostOnlyInterface(hostOnlyInterface string) error

func (*NetworkAdapter) SetInternalNetwork

func (adapter *NetworkAdapter) SetInternalNetwork(internalNetwork string) error

func (*NetworkAdapter) SetMACAddress

func (adapter *NetworkAdapter) SetMACAddress(macAddress string) error

func (*NetworkAdapter) SetNATNetwork

func (adapter *NetworkAdapter) SetNATNetwork(natNetwork string) error

type NetworkAdapterType

type NetworkAdapterType uint

Enumeration of NetworkAdapterType values

type NetworkAttachmentType

type NetworkAttachmentType uint

Enumeration of NetworkAttachmentType values

type PointingHidType

type PointingHidType uint

Enumeration of PointingHIDType values

type Progress

type Progress struct {
	// contains filtered or unexported fields
}

Tracks the progress of a long-running operation.

func (*Progress) GetPercent

func (progress *Progress) GetPercent() (int, error)

GetPercent returns the completion percentage of the tracked operation. It returns a number and any error encountered.

func (*Progress) GetResultCode

func (progress *Progress) GetResultCode() (int, error)

GetResultCode returns the result code of the tracked operation. It returns a number and any error encountered.

func (*Progress) Initialized

func (progress *Progress) Initialized() bool

Initialized returns true if there is VirtualBox data associated with this.

func (*Progress) Release

func (progress *Progress) Release() error

Release frees up the associated VirtualBox data. After the call, this instance is invalid, and using it will cause errors. It returns any error encountered.

func (*Progress) WaitForCompletion

func (progress *Progress) WaitForCompletion(timeout int) error

WaitForCompletion waits for all the operations tracked by this to complete. The timeout argument is in milliseconds. -1 is used to wait indefinitely. It returns any error encountered.

type Resolution

type Resolution struct {
	Width              uint
	Height             uint
	BitsPerPixel       uint
	XOrigin            int
	YOrigin            int
	GuestMonitorStatus uint
}

Represents the resolution of a running VM's display.

type Session

type Session struct {
	// contains filtered or unexported fields
}

A session gets associated to a VM lock.

func (*Session) GetConsole

func (session *Session) GetConsole() (Console, error)

GetConsole obtains the controls for the VM associated with this session. The call fails unless the VM associated with this session has started. It returns a new Console instance and any error encountered.

func (*Session) GetMachine

func (session *Session) GetMachine() (Machine, error)

GetMachine obtains the VM associated with this session. It returns a new Machine instance and any error encountered.

func (*Session) GetState

func (session *Session) GetState() (SessionState, error)

GetState obtains the current state of this session. It returns the SessionState and any error encountered.

func (*Session) GetType

func (session *Session) GetType() (SessionType, error)

GetType obtains the session's type. It returns the SessionType and any error encountered.

func (*Session) Init

func (session *Session) Init() error

Init creates the session object on the VirtualBox side.

func (*Session) Initialized

func (session *Session) Initialized() bool

Initialized returns true if there is VirtualBox data associated with this.

func (*Session) LockMachine

func (session *Session) LockMachine(machine Machine, lockType LockType) error

LockMachine obtains a lock on a VM, so it can be modified or started. It returns any error encountered.

func (*Session) Release

func (session *Session) Release() error

Release frees up the associated VirtualBox data. After the call, this instance is invalid, and using it will cause errors. It returns any error encountered.

func (*Session) UnlockMachine

func (session *Session) UnlockMachine() error

UnlockMachine releases the VM locked by this session. It returns any error encountered.

type SessionState

type SessionState uint

Enumeration of SessionState values

type SessionType

type SessionType uint

Enumeration of SessionType values

type StorageBus

type StorageBus uint

Enumeration of StorageBus values

type StorageController

type StorageController struct {
	// contains filtered or unexported fields
}

The description of a VirtualBox storage controller

func (*StorageController) GetBus

func (controller *StorageController) GetBus() (StorageBus, error)

GetBus returns the controller's bus type. It returns a number and any error encountered.

func (*StorageController) GetName

func (controller *StorageController) GetName() (string, error)

GetName returns the controller's name. The controller's name identifies it in AttachDevice() calls. It returns a string and any error encountered.

func (*StorageController) GetType

func (controller *StorageController) GetType() (StorageControllerType, error)

GetType returns the controller's type. It returns a number and any error encountered.

func (*StorageController) Initialized

func (controller *StorageController) Initialized() bool

Initialized returns true if there is VirtualBox data associated with this.

func (*StorageController) Release

func (controller *StorageController) Release() error

Release frees up the associated VirtualBox data. After the call, this instance is invalid, and using it will cause errors. It returns any error encountered.

func (*StorageController) SetType

func (controller *StorageController) SetType(
	controllerType StorageControllerType) error

SetType changes the controller's type. It returns a number and any error encountered.

type StorageControllerType

type StorageControllerType uint

Enumeration of StorageControllerType values

type SystemProperties

type SystemProperties struct {
	// contains filtered or unexported fields
}

The description of a VirtualBox storage medium

func GetSystemProperties

func GetSystemProperties() (SystemProperties, error)

GetSystemProperties fetches the VirtualBox system properties. It returns the a new SystemProperties instance and any error encountered.

func (*SystemProperties) GetMaxGuestCpuCount

func (props *SystemProperties) GetMaxGuestCpuCount() (uint, error)

GetMaxGuestCpuCount reads the maximum number of CPUs on a guest VM. It returns a number and any error encountered.

func (*SystemProperties) GetMaxGuestRam

func (props *SystemProperties) GetMaxGuestRam() (uint, error)

GetMaxGuestRAM reads the maximum allowed amount of RAM on a guest VM. It returns a megabyte quantity and any error encountered.

func (*SystemProperties) GetMaxGuestVram

func (props *SystemProperties) GetMaxGuestVram() (uint, error)

GetMaxGuestVRAM reads the maximum allowed amount of video RAM on a guest VM. It returns a megabyte quantity and any error encountered.

func (*SystemProperties) GetMediumFormats

func (props *SystemProperties) GetMediumFormats() ([]MediumFormat, error)

GetMediumFormats returns the guest OS formats supported by VirtualBox. It returns a slice of MediumFormat instances and any error encountered.

func (*SystemProperties) Initialized

func (props *SystemProperties) Initialized() bool

Initialized returns true if there is VirtualBox data associated with this.

func (*SystemProperties) Release

func (props *SystemProperties) Release() error

Release frees up the associated VirtualBox data. After the call, this instance is invalid, and using it will cause errors. It returns any error encountered.

type UsbController

type UsbController struct {
	// contains filtered or unexported fields
}

The description of a VirtualBox USB controller

func (*UsbController) GetName

func (controller *UsbController) GetName() (string, error)

GetName returns the controller's name. It returns a string and any error encountered.

func (*UsbController) GetStandard

func (controller *UsbController) GetStandard() (int, int, error)

GetStandard returns the USB standard supported by the controller. It returns two numbers (the major and minor versions of the standard), and any error encountered.

func (*UsbController) GetType

func (controller *UsbController) GetType() (UsbControllerType, error)

GetType returns the controller's type. It returns a number and any error encountered.

func (*UsbController) Initialized

func (controller *UsbController) Initialized() bool

Initialized returns true if there is VirtualBox data associated with this.

func (*UsbController) Release

func (controller *UsbController) Release() error

Release frees up the associated VirtualBox data. After the call, this instance is invalid, and using it will cause errors. It returns any error encountered.

type UsbControllerType

type UsbControllerType uint

Enumeration of UsbControllerType values

Directories

Path Synopsis
samples

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL