govmomi

package module
v0.0.0-...-dbc992d Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2014 License: Apache-2.0 Imports: 14 Imported by: 0

README

Build Status

govmomi

A Go library for interacting with VMware vSphere APIs (ESXi and/or vCenter).

For govc, a CLI built on top of govmomi, check out the govc directory.

Compatibility

This library is built for and tested against ESXi and vCenter 5.5.

If you're able to use it against older versions of ESXi and/or vCenter, please leave a note and we'll include it in this compatibility list.

Documentation

The APIs exposed by this library very closely follow the API described in the VMware vSphere API Reference Documentation. Refer to this document to become familiar with the upstream API.

The code in the govmomi package is a wrapper for the code that is generated from the vSphere API description. It primarily provides convenience functions for working with the vSphere API. See godoc.org for documentation.

Status

The API is a work in progress. Because the code in the vim25 package is generated from the vSphere API description, you can safely use all types and functions in those packages without worrying about deprecation. The code in the the root govmomi package is what is a work in progress.

After the library reaches v1.0, changes to the API will be subject to semantic versioning.

License

govmomi is available under the Apache 2 license.

Documentation

Index

Constants

View Source
const (
	DeviceTypeCdrom    = "cdrom"
	DeviceTypeDisk     = "disk"
	DeviceTypeEthernet = "ethernet"
	DeviceTypeFloppy   = "floppy"
)

Type values for use in BootOrder

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Client         *soap.Client
	ServiceContent types.ServiceContent
}

func NewClient

func NewClient(u url.URL, insecure bool) (*Client, error)

func (*Client) Ancestors

func (c *Client) Ancestors(r Reference) ([]mo.ManagedEntity, error)

Ancestors returns the entire ancestry tree of a specified managed object. The return value includes the root node and the specified object itself.

func (*Client) FileManager

func (c *Client) FileManager() FileManager

func (*Client) GuestOperationsManager

func (c *Client) GuestOperationsManager() GuestOperationsManager

func (*Client) LicenseManager

func (c *Client) LicenseManager() LicenseManager

func (*Client) NewPropertyCollector

func (c *Client) NewPropertyCollector() (*PropertyCollector, error)

NewPropertyCollector creates a new property collector based on the root property collector. It is the responsibility of the caller to clean up the property collector when done.

func (*Client) OvfManager

func (c *Client) OvfManager() OvfManager

func (*Client) Properties

func (c *Client) Properties(obj types.ManagedObjectReference, p []string, dst interface{}) error

func (*Client) RootFolder

func (c *Client) RootFolder() *Folder

func (*Client) RoundTrip

func (c *Client) RoundTrip(req, res soap.HasFault) error

RoundTrip dispatches to the client's SOAP client RoundTrip function.

func (*Client) SearchIndex

func (c *Client) SearchIndex() SearchIndex

func (*Client) UserSession

func (c *Client) UserSession() (*types.UserSession, error)

func (*Client) VirtualDiskManager

func (c *Client) VirtualDiskManager() VirtualDiskManager

func (*Client) WaitForProperties

func (c *Client) WaitForProperties(obj types.ManagedObjectReference, ps []string, f func([]types.PropertyChange) bool) error

type ClusterComputeResource

type ClusterComputeResource struct {
	ComputeResource
}

type ComputeResource

type ComputeResource struct {
	types.ManagedObjectReference
}

func (ComputeResource) Reference

type Datacenter

type Datacenter struct {
	types.ManagedObjectReference
	// contains filtered or unexported fields
}

func NewDatacenter

func NewDatacenter(c *Client, ref types.ManagedObjectReference) *Datacenter

func (*Datacenter) Folders

func (d *Datacenter) Folders() (*DatacenterFolders, error)

func (Datacenter) Reference

func (d Datacenter) Reference() types.ManagedObjectReference

type DatacenterFolders

type DatacenterFolders struct {
	VmFolder        *Folder
	HostFolder      *Folder
	DatastoreFolder *Folder
	NetworkFolder   *Folder
}

type Datastore

type Datastore struct {
	types.ManagedObjectReference

	InventoryPath string
	// contains filtered or unexported fields
}

func NewDatastore

func NewDatastore(c *Client, ref types.ManagedObjectReference) *Datastore

func (Datastore) Browser

func (d Datastore) Browser() (*HostDatastoreBrowser, error)

func (Datastore) Name

func (d Datastore) Name() string

func (Datastore) Path

func (d Datastore) Path(path string) string

func (Datastore) Reference

func (d Datastore) Reference() types.ManagedObjectReference

func (Datastore) URL

func (d Datastore) URL(dc *Datacenter, path string) (*url.URL, error)

URL for datastore access over HTTP

type DistributedVirtualPortgroup

type DistributedVirtualPortgroup struct {
	types.ManagedObjectReference

	InventoryPath string
	// contains filtered or unexported fields
}

func (DistributedVirtualPortgroup) EthernetCardBackingInfo

EthernetCardBackingInfo returns the VirtualDeviceBackingInfo for this DistributedVirtualPortgroup

func (DistributedVirtualPortgroup) Name

func (DistributedVirtualPortgroup) Reference

type DistributedVirtualSwitch

type DistributedVirtualSwitch struct {
	types.ManagedObjectReference
}

func (DistributedVirtualSwitch) Reference

type FileManager

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

func (FileManager) CopyDatastoreFile

func (f FileManager) CopyDatastoreFile(sourceName string, sourceDatacenter *Datacenter, destinationName string, destinationDatacenter *Datacenter, force bool) (*Task, error)

func (FileManager) DeleteDatastoreFile

func (f FileManager) DeleteDatastoreFile(name string, dc *Datacenter) (*Task, error)

DeleteDatastoreFile deletes the specified file or folder from the datastore.

func (FileManager) MakeDirectory

func (f FileManager) MakeDirectory(name string, dc *Datacenter, createParentDirectories bool) error

MakeDirectory creates a folder using the specified name.

func (FileManager) MoveDatastoreFile

func (f FileManager) MoveDatastoreFile(sourceName string, sourceDatacenter *Datacenter, destinationName string, destinationDatacenter *Datacenter, force bool) (*Task, error)

type Folder

type Folder struct {
	types.ManagedObjectReference
	// contains filtered or unexported fields
}

func NewFolder

func NewFolder(c *Client, ref types.ManagedObjectReference) *Folder

func (Folder) Children

func (f Folder) Children() ([]Reference, error)

func (Folder) CreateVM

func (f Folder) CreateVM(config types.VirtualMachineConfigSpec, pool *ResourcePool, host *HostSystem) (*Task, error)

func (Folder) Reference

func (f Folder) Reference() types.ManagedObjectReference

type GuestAuthManager

type GuestAuthManager struct {
	types.ManagedObjectReference
	// contains filtered or unexported fields
}

func (GuestAuthManager) AcquireCredentialsInGuest

func (m GuestAuthManager) AcquireCredentialsInGuest(vm *VirtualMachine, requestedAuth types.BaseGuestAuthentication, sessionID int64) (types.BaseGuestAuthentication, error)

func (GuestAuthManager) Reference

func (GuestAuthManager) ReleaseCredentialsInGuest

func (m GuestAuthManager) ReleaseCredentialsInGuest(vm *VirtualMachine, auth types.BaseGuestAuthentication) error

func (GuestAuthManager) ValidateCredentialsInGuest

func (m GuestAuthManager) ValidateCredentialsInGuest(vm *VirtualMachine, auth types.BaseGuestAuthentication) error

type GuestFileManager

type GuestFileManager struct {
	types.ManagedObjectReference
	// contains filtered or unexported fields
}

func (GuestFileManager) ChangeFileAttributesInGuest

func (m GuestFileManager) ChangeFileAttributesInGuest(vm *VirtualMachine, auth types.BaseGuestAuthentication, guestFilePath string, fileAttributes types.BaseGuestFileAttributes) error

func (GuestFileManager) CreateTemporaryDirectoryInGuest

func (m GuestFileManager) CreateTemporaryDirectoryInGuest(vm *VirtualMachine, auth types.BaseGuestAuthentication, prefix, suffix string) (string, error)

func (GuestFileManager) CreateTemporaryFileInGuest

func (m GuestFileManager) CreateTemporaryFileInGuest(vm *VirtualMachine, auth types.BaseGuestAuthentication, prefix, suffix string) (string, error)

func (GuestFileManager) DeleteDirectoryInGuest

func (m GuestFileManager) DeleteDirectoryInGuest(vm *VirtualMachine, auth types.BaseGuestAuthentication, directoryPath string, recursive bool) error

func (GuestFileManager) DeleteFileInGuest

func (m GuestFileManager) DeleteFileInGuest(vm *VirtualMachine, auth types.BaseGuestAuthentication, filePath string) error

func (GuestFileManager) InitiateFileTransferFromGuest

func (m GuestFileManager) InitiateFileTransferFromGuest(vm *VirtualMachine, auth types.BaseGuestAuthentication, guestFilePath string) (*types.FileTransferInformation, error)

func (GuestFileManager) InitiateFileTransferToGuest

func (m GuestFileManager) InitiateFileTransferToGuest(vm *VirtualMachine, auth types.BaseGuestAuthentication, guestFilePath string, fileAttributes types.BaseGuestFileAttributes, fileSize int64, overwrite bool) (string, error)

func (GuestFileManager) ListFilesInGuest

func (m GuestFileManager) ListFilesInGuest(vm *VirtualMachine, auth types.BaseGuestAuthentication, filePath string, index int, maxResults int, matchPattern string) (*types.GuestListFileInfo, error)

func (GuestFileManager) MakeDirectoryInGuest

func (m GuestFileManager) MakeDirectoryInGuest(vm *VirtualMachine, auth types.BaseGuestAuthentication, directoryPath string, createParentDirectories bool) error

func (GuestFileManager) MoveDirectoryInGuest

func (m GuestFileManager) MoveDirectoryInGuest(vm *VirtualMachine, auth types.BaseGuestAuthentication, srcDirectoryPath string, dstDirectoryPath string) error

func (GuestFileManager) MoveFileInGuest

func (m GuestFileManager) MoveFileInGuest(vm *VirtualMachine, auth types.BaseGuestAuthentication, srcFilePath string, dstFilePath string, overwrite bool) error

func (GuestFileManager) Reference

type GuestOperationsManager

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

func (GuestOperationsManager) AuthManager

func (m GuestOperationsManager) AuthManager() (*GuestAuthManager, error)

func (GuestOperationsManager) FileManager

func (m GuestOperationsManager) FileManager() (*GuestFileManager, error)

func (GuestOperationsManager) ProcessManager

func (m GuestOperationsManager) ProcessManager() (*GuestProcessManager, error)

type GuestProcessManager

type GuestProcessManager struct {
	types.ManagedObjectReference
	// contains filtered or unexported fields
}

func (GuestProcessManager) ListProcessesInGuest

func (m GuestProcessManager) ListProcessesInGuest(vm *VirtualMachine, auth types.BaseGuestAuthentication, pids []int64) ([]types.GuestProcessInfo, error)

func (GuestProcessManager) ReadEnvironmentVariableInGuest

func (m GuestProcessManager) ReadEnvironmentVariableInGuest(vm *VirtualMachine, auth types.BaseGuestAuthentication, names []string) ([]string, error)

func (GuestProcessManager) Reference

func (GuestProcessManager) StartProgramInGuest

func (GuestProcessManager) TerminateProcessInGuest

func (m GuestProcessManager) TerminateProcessInGuest(vm *VirtualMachine, auth types.BaseGuestAuthentication, pid int64) error

type HostConfigManager

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

func (HostConfigManager) NetworkSystem

func (m HostConfigManager) NetworkSystem() (*HostNetworkSystem, error)

type HostDatastoreBrowser

type HostDatastoreBrowser struct {
	types.ManagedObjectReference
	// contains filtered or unexported fields
}

func (HostDatastoreBrowser) Reference

func (HostDatastoreBrowser) SearchDatastore

func (b HostDatastoreBrowser) SearchDatastore(datastorePath string, searchSpec *types.HostDatastoreBrowserSearchSpec) (*Task, error)

func (HostDatastoreBrowser) SearchDatastoreSubFolders

func (b HostDatastoreBrowser) SearchDatastoreSubFolders(datastorePath string, searchSpec *types.HostDatastoreBrowserSearchSpec) (*Task, error)

type HostNetworkSystem

type HostNetworkSystem struct {
	types.ManagedObjectReference
	mo.HostNetworkSystem
	// contains filtered or unexported fields
}

func (HostNetworkSystem) AddPortGroup

func (o HostNetworkSystem) AddPortGroup(portgrp types.HostPortGroupSpec) error

AddPortGroup wraps methods.AddPortGroup

func (HostNetworkSystem) AddServiceConsoleVirtualNic

func (o HostNetworkSystem) AddServiceConsoleVirtualNic(portgroup string, nic types.HostVirtualNicSpec) (string, error)

AddServiceConsoleVirtualNic wraps methods.AddServiceConsoleVirtualNic

func (HostNetworkSystem) AddVirtualNic

func (o HostNetworkSystem) AddVirtualNic(portgroup string, nic types.HostVirtualNicSpec) (string, error)

AddVirtualNic wraps methods.AddVirtualNic

func (HostNetworkSystem) AddVirtualSwitch

func (o HostNetworkSystem) AddVirtualSwitch(vswitchName string, spec *types.HostVirtualSwitchSpec) error

AddVirtualSwitch wraps methods.AddVirtualSwitch

func (*HostNetworkSystem) Properties

func (o *HostNetworkSystem) Properties(props []string) error

func (HostNetworkSystem) QueryNetworkHint

func (o HostNetworkSystem) QueryNetworkHint(device []string) error

QueryNetworkHint wraps methods.QueryNetworkHint

func (*HostNetworkSystem) Reference

func (HostNetworkSystem) RefreshNetworkSystem

func (o HostNetworkSystem) RefreshNetworkSystem() error

RefreshNetworkSystem wraps methods.RefreshNetworkSystem

func (HostNetworkSystem) RemovePortGroup

func (o HostNetworkSystem) RemovePortGroup(pgName string) error

RemovePortGroup wraps methods.RemovePortGroup

func (HostNetworkSystem) RemoveServiceConsoleVirtualNic

func (o HostNetworkSystem) RemoveServiceConsoleVirtualNic(device string) error

RemoveServiceConsoleVirtualNic wraps methods.RemoveServiceConsoleVirtualNic

func (HostNetworkSystem) RemoveVirtualNic

func (o HostNetworkSystem) RemoveVirtualNic(device string) error

RemoveVirtualNic wraps methods.RemoveVirtualNic

func (HostNetworkSystem) RemoveVirtualSwitch

func (o HostNetworkSystem) RemoveVirtualSwitch(vswitchName string) error

RemoveVirtualSwitch wraps methods.RemoveVirtualSwitch

func (HostNetworkSystem) RestartServiceConsoleVirtualNic

func (o HostNetworkSystem) RestartServiceConsoleVirtualNic(device string) error

RestartServiceConsoleVirtualNic wraps methods.RestartServiceConsoleVirtualNic

func (HostNetworkSystem) UpdateConsoleIpRouteConfig

func (o HostNetworkSystem) UpdateConsoleIpRouteConfig(config types.BaseHostIpRouteConfig) error

UpdateConsoleIpRouteConfig wraps methods.UpdateConsoleIpRouteConfig

func (HostNetworkSystem) UpdateDnsConfig

func (o HostNetworkSystem) UpdateDnsConfig(config types.BaseHostDnsConfig) error

UpdateDnsConfig wraps methods.UpdateDnsConfig

func (HostNetworkSystem) UpdateIpRouteConfig

func (o HostNetworkSystem) UpdateIpRouteConfig(config types.BaseHostIpRouteConfig) error

UpdateIpRouteConfig wraps methods.UpdateIpRouteConfig

func (HostNetworkSystem) UpdateIpRouteTableConfig

func (o HostNetworkSystem) UpdateIpRouteTableConfig(config types.HostIpRouteTableConfig) error

UpdateIpRouteTableConfig wraps methods.UpdateIpRouteTableConfig

func (HostNetworkSystem) UpdateNetworkConfig

func (o HostNetworkSystem) UpdateNetworkConfig(config types.HostNetworkConfig, changeMode string) (*types.HostNetworkConfigResult, error)

UpdateNetworkConfig wraps methods.UpdateNetworkConfig

func (HostNetworkSystem) UpdatePhysicalNicLinkSpeed

func (o HostNetworkSystem) UpdatePhysicalNicLinkSpeed(device string, linkSpeed *types.PhysicalNicLinkInfo) error

UpdatePhysicalNicLinkSpeed wraps methods.UpdatePhysicalNicLinkSpeed

func (HostNetworkSystem) UpdatePortGroup

func (o HostNetworkSystem) UpdatePortGroup(pgName string, portgrp types.HostPortGroupSpec) error

UpdatePortGroup wraps methods.UpdatePortGroup

func (HostNetworkSystem) UpdateServiceConsoleVirtualNic

func (o HostNetworkSystem) UpdateServiceConsoleVirtualNic(device string, nic types.HostVirtualNicSpec) error

UpdateServiceConsoleVirtualNic wraps methods.UpdateServiceConsoleVirtualNic

func (HostNetworkSystem) UpdateVirtualNic

func (o HostNetworkSystem) UpdateVirtualNic(device string, nic types.HostVirtualNicSpec) error

UpdateVirtualNic wraps methods.UpdateVirtualNic

func (HostNetworkSystem) UpdateVirtualSwitch

func (o HostNetworkSystem) UpdateVirtualSwitch(vswitchName string, spec types.HostVirtualSwitchSpec) error

UpdateVirtualSwitch wraps methods.UpdateVirtualSwitch

type HostSystem

type HostSystem struct {
	types.ManagedObjectReference
	// contains filtered or unexported fields
}

func NewHostSystem

func NewHostSystem(c *Client, ref types.ManagedObjectReference) *HostSystem

func (HostSystem) ConfigManager

func (h HostSystem) ConfigManager() *HostConfigManager

func (HostSystem) Reference

func (h HostSystem) Reference() types.ManagedObjectReference

func (HostSystem) ResourcePool

func (h HostSystem) ResourcePool() (*ResourcePool, error)

type HttpNfcLease

type HttpNfcLease struct {
	types.ManagedObjectReference
	// contains filtered or unexported fields
}

func NewHttpNfcLease

func NewHttpNfcLease(c *Client, ref types.ManagedObjectReference) *HttpNfcLease

func (HttpNfcLease) HttpNfcLeaseAbort

func (o HttpNfcLease) HttpNfcLeaseAbort(fault *types.LocalizedMethodFault) error

HttpNfcLeaseAbort wraps methods.HttpNfcLeaseAbort

func (HttpNfcLease) HttpNfcLeaseComplete

func (o HttpNfcLease) HttpNfcLeaseComplete() error

HttpNfcLeaseComplete wraps methods.HttpNfcLeaseComplete

func (HttpNfcLease) HttpNfcLeaseGetManifest

func (o HttpNfcLease) HttpNfcLeaseGetManifest() error

HttpNfcLeaseGetManifest wraps methods.HttpNfcLeaseGetManifest

func (HttpNfcLease) HttpNfcLeaseProgress

func (o HttpNfcLease) HttpNfcLeaseProgress(percent int) error

HttpNfcLeaseProgress wraps methods.HttpNfcLeaseProgress

func (HttpNfcLease) Reference

func (HttpNfcLease) Wait

type LicenseManager

type LicenseManager struct {
	types.ManagedObjectReference
	// contains filtered or unexported fields
}

func NewLicenseManager

func NewLicenseManager(c *Client, ref types.ManagedObjectReference) LicenseManager

func (LicenseManager) AddLicense

func (l LicenseManager) AddLicense(key string, labels map[string]string) (types.LicenseManagerLicenseInfo, error)

func (LicenseManager) ListLicenses

func (l LicenseManager) ListLicenses() ([]types.LicenseManagerLicenseInfo, error)

func (LicenseManager) Reference

func (LicenseManager) RemoveLicense

func (l LicenseManager) RemoveLicense(key string) error

func (LicenseManager) UpdateLicense

func (l LicenseManager) UpdateLicense(key string, labels map[string]string) (types.LicenseManagerLicenseInfo, error)

type Network

type Network struct {
	types.ManagedObjectReference

	InventoryPath string
	// contains filtered or unexported fields
}

func NewNetwork

func NewNetwork(c *Client, ref types.ManagedObjectReference) *Network

func (Network) EthernetCardBackingInfo

func (n Network) EthernetCardBackingInfo() (types.BaseVirtualDeviceBackingInfo, error)

EthernetCardBackingInfo returns the VirtualDeviceBackingInfo for this Network

func (Network) Name

func (n Network) Name() string

func (Network) Reference

func (n Network) Reference() types.ManagedObjectReference

type NetworkReference

type NetworkReference interface {
	EthernetCardBackingInfo() (types.BaseVirtualDeviceBackingInfo, error)
}

The NetworkReference interface is implemented by managed objects which can be used as the backing for a VirtualEthernetCard.

type OvfManager

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

func (OvfManager) CreateDescriptor

CreateDescriptor wraps methods.CreateDescriptor

func (OvfManager) CreateImportSpec

func (o OvfManager) CreateImportSpec(ovfDescriptor string, resourcePool Reference, datastore Reference, cisp types.OvfCreateImportSpecParams) (*types.OvfCreateImportSpecResult, error)

CreateImportSpec wraps methods.CreateImportSpec

func (OvfManager) ParseDescriptor

func (o OvfManager) ParseDescriptor(ovfDescriptor string, pdp types.OvfParseDescriptorParams) (*types.OvfParseDescriptorResult, error)

ParseDescriptor wraps methods.ParseDescriptor

func (OvfManager) ValidateHost

func (o OvfManager) ValidateHost(ovfDescriptor string, host Reference, vhp types.OvfValidateHostParams) (*types.OvfValidateHostResult, error)

ValidateHost wraps methods.ValidateHost

type PropertyCollector

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

func (*PropertyCollector) CreateFilter

func (p *PropertyCollector) CreateFilter(req types.CreateFilter) error

func (*PropertyCollector) Destroy

func (p *PropertyCollector) Destroy() error

func (*PropertyCollector) WaitForUpdates

func (p *PropertyCollector) WaitForUpdates(v string) (*types.UpdateSet, error)

type Reference

type Reference interface {
	Reference() types.ManagedObjectReference
}

type ResourcePool

type ResourcePool struct {
	types.ManagedObjectReference
	// contains filtered or unexported fields
}

func NewResourcePool

func NewResourcePool(c *Client, ref types.ManagedObjectReference) *ResourcePool

func (ResourcePool) ImportVApp

func (p ResourcePool) ImportVApp(spec types.BaseImportSpec, folder *Folder, host *HostSystem) (*HttpNfcLease, error)

func (ResourcePool) Reference

type SearchIndex

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

func (SearchIndex) FindByDatastorePath

func (s SearchIndex) FindByDatastorePath(dc *Datacenter, path string) (Reference, error)

FindByDatastorePath finds a virtual machine by its location on a datastore.

func (SearchIndex) FindByDnsName

func (s SearchIndex) FindByDnsName(dc *Datacenter, dnsName string, vmSearch bool) (Reference, error)

FindByDnsName finds a virtual machine or host by DNS name.

func (SearchIndex) FindByInventoryPath

func (s SearchIndex) FindByInventoryPath(path string) (Reference, error)

FindByInventoryPath finds a managed entity based on its location in the inventory.

func (SearchIndex) FindByIp

func (s SearchIndex) FindByIp(dc *Datacenter, ip string, vmSearch bool) (Reference, error)

FindByIp finds a virtual machine or host by IP address.

func (SearchIndex) FindByUuid

func (s SearchIndex) FindByUuid(dc *Datacenter, uuid string, vmSearch bool) (Reference, error)

FindByUuid finds a virtual machine or host by UUID.

func (SearchIndex) FindChild

func (s SearchIndex) FindChild(entity Reference, name string) (Reference, error)

FindChild finds a particular child based on a managed entity name.

type StoragePod

type StoragePod struct {
	*Folder
}

type Task

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

Task adds functionality for the Task managed object.

func NewTask

func NewTask(c *Client, ref types.ManagedObjectReference) *Task

func (*Task) Wait

func (t *Task) Wait() error

func (*Task) WaitForResult

func (t *Task) WaitForResult(s progress.Sinker) (*types.TaskInfo, error)

type VirtualApp

type VirtualApp struct {
	*ResourcePool
}

type VirtualDeviceList

type VirtualDeviceList []types.BaseVirtualDevice

VirtualDeviceList provides helper methods for working with a list of virtual devices.

func EthernetCardTypes

func EthernetCardTypes() VirtualDeviceList

EthernetCardTypes are used for adding a new ethernet card to a VM.

func SCSIControllerTypes

func SCSIControllerTypes() VirtualDeviceList

SCSIControllerTypes are used for adding a new SCSI controller to a VM.

func (VirtualDeviceList) AssignController

AssignController assigns a device to a controller.

func (VirtualDeviceList) BootOrder

BootOrder returns a list of devices which can be used to set boot order via VirtualMachine.SetBootOptions. The order can any of "ethernet", "cdrom", "floppy" or "disk" or by specific device name.

func (VirtualDeviceList) ChildDisk

func (l VirtualDeviceList) ChildDisk(parent *types.VirtualDisk) *types.VirtualDisk

ChildDisk creates a new VirtualDisk device, linked to the given parent disk, which can be added to a VM.

func (VirtualDeviceList) Connect

func (l VirtualDeviceList) Connect(device types.BaseVirtualDevice) error

Connect changes the device to connected, returns an error if the device is not connectable.

func (VirtualDeviceList) ConnectSerialPort

func (l VirtualDeviceList) ConnectSerialPort(device *types.VirtualSerialPort, uri string, client bool) *types.VirtualSerialPort

ConnectSerialPort connects a serial port to a server or client uri.

func (VirtualDeviceList) CreateCdrom

CreateCdrom creates a new VirtualCdrom device which can be added to a VM.

func (VirtualDeviceList) CreateDisk

CreateDisk creates a new VirtualDisk device which can be added to a VM.

func (VirtualDeviceList) CreateEthernetCard

CreateEthernetCard creates a new VirtualEthernetCard of the given name name and initialized with the given backing.

func (VirtualDeviceList) CreateFloppy

func (l VirtualDeviceList) CreateFloppy() (*types.VirtualFloppy, error)

CreateFloppy creates a new VirtualFloppy device which can be added to a VM.

func (VirtualDeviceList) CreateSCSIController

func (l VirtualDeviceList) CreateSCSIController(name string) (types.BaseVirtualDevice, error)

CreateSCSIController creates a new SCSI controller of type name if given, otherwise defaults to lsilogic.

func (VirtualDeviceList) CreateSerialPort

func (l VirtualDeviceList) CreateSerialPort() (*types.VirtualSerialPort, error)

CreateSerialPort creates a new VirtualSerialPort device which can be added to a VM.

func (VirtualDeviceList) Disconnect

func (l VirtualDeviceList) Disconnect(device types.BaseVirtualDevice) error

Disconnect changes the device to disconnected, returns an error if the device is not connectable.

func (VirtualDeviceList) DisconnectSerialPort

func (l VirtualDeviceList) DisconnectSerialPort(device *types.VirtualSerialPort) *types.VirtualSerialPort

DisconnectSerialPort disconnects the serial port backing.

func (VirtualDeviceList) EjectImg

EjectImg removes the img file based backing and replaces with the default floppy backing.

func (VirtualDeviceList) EjectIso

func (l VirtualDeviceList) EjectIso(device *types.VirtualCdrom) *types.VirtualCdrom

EjectIso removes the iso file based backing and replaces with the default cdrom backing.

func (VirtualDeviceList) Find

Find returns the device matching the given name.

func (VirtualDeviceList) FindByKey

func (l VirtualDeviceList) FindByKey(key int) types.BaseVirtualDevice

FindByKey returns the device matching the given key.

func (VirtualDeviceList) FindCdrom

func (l VirtualDeviceList) FindCdrom(name string) (*types.VirtualCdrom, error)

FindCdrom finds a cdrom device with the given name, defaulting to the first cdrom device if any.

func (VirtualDeviceList) FindDiskController

func (l VirtualDeviceList) FindDiskController(name string) (types.BaseVirtualController, error)

FindDiskController will find an existing ide or scsi disk controller.

func (VirtualDeviceList) FindFloppy

func (l VirtualDeviceList) FindFloppy(name string) (*types.VirtualFloppy, error)

FindFloppy finds a floppy device with the given name, defaulting to the first floppy device if any.

func (VirtualDeviceList) FindIDEController

func (l VirtualDeviceList) FindIDEController(name string) (*types.VirtualIDEController, error)

FindIDEController will find the named IDE controller if given, otherwise will pick an available controller. An error is returned if the named controller is not found or not an IDE controller. Or, if name is not given and no available controller can be found.

func (VirtualDeviceList) FindSCSIController

func (l VirtualDeviceList) FindSCSIController(name string) (*types.VirtualSCSIController, error)

FindSCSIController will find the named SCSI controller if given, otherwise will pick an available controller. An error is returned if the named controller is not found or not an SCSI controller. Or, if name is not given and no available controller can be found.

func (VirtualDeviceList) FindSerialPort

func (l VirtualDeviceList) FindSerialPort(name string) (*types.VirtualSerialPort, error)

FindSerialPort finds a serial port device with the given name, defaulting to the first serial port device if any.

func (VirtualDeviceList) InsertImg

func (l VirtualDeviceList) InsertImg(device *types.VirtualFloppy, img string) *types.VirtualFloppy

InsertImg changes the floppy device backing to use the given img file.

func (VirtualDeviceList) InsertIso

func (l VirtualDeviceList) InsertIso(device *types.VirtualCdrom, iso string) *types.VirtualCdrom

InsertIso changes the cdrom device backing to use the given iso file.

func (VirtualDeviceList) Name

Name returns a stable, human-readable name for the given device

func (VirtualDeviceList) PickController

PickController returns a controller of the given type(s). If no controllers are found or have no available slots, then nil is returned.

func (VirtualDeviceList) PrimaryMacAddress

func (l VirtualDeviceList) PrimaryMacAddress() string

PrimaryMacAddress returns the MacAddress field of the primary VirtualEthernetCard

func (VirtualDeviceList) Select

Select returns a new list containing all elements of the list for which the given func returns true.

func (VirtualDeviceList) SelectBootOrder

SelectBootOrder returns an ordered list of devices matching the given bootable device order

func (VirtualDeviceList) SelectByBackingInfo

SelectByBackingInfo returns a new list with devices matching the given backing info.

func (VirtualDeviceList) SelectByType

func (l VirtualDeviceList) SelectByType(deviceType types.BaseVirtualDevice) VirtualDeviceList

SelectByType returns a new list with devices that are equal to or extend the given type.

func (VirtualDeviceList) Type

Type returns a human-readable name for the given device

func (VirtualDeviceList) TypeName

func (l VirtualDeviceList) TypeName(device types.BaseVirtualDevice) string

TypeName returns the vmodl type name of the device

type VirtualDiskManager

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

func (VirtualDiskManager) CopyVirtualDisk

func (m VirtualDiskManager) CopyVirtualDisk(
	sourceName string, sourceDatacenter *Datacenter,
	destName string, destDatacenter *Datacenter,
	destSpec *types.VirtualDiskSpec, force bool) (*Task, error)

CopyVirtualDisk copies a virtual disk, performing conversions as specified in the spec.

func (VirtualDiskManager) DeleteVirtualDisk

func (m VirtualDiskManager) DeleteVirtualDisk(name string, dc *Datacenter) (*Task, error)

DeleteVirtualDisk deletes a virtual disk.

func (VirtualDiskManager) MoveVirtualDisk

func (m VirtualDiskManager) MoveVirtualDisk(
	sourceName string, sourceDatacenter *Datacenter,
	destName string, destDatacenter *Datacenter,
	force bool) (*Task, error)

MoveVirtualDisk moves a virtual disk.

type VirtualMachine

type VirtualMachine struct {
	types.ManagedObjectReference
	// contains filtered or unexported fields
}

func NewVirtualMachine

func NewVirtualMachine(c *Client, ref types.ManagedObjectReference) *VirtualMachine

func (VirtualMachine) AddDevice

func (v VirtualMachine) AddDevice(device ...types.BaseVirtualDevice) error

AddDevice adds the given devices to the VirtualMachine

func (VirtualMachine) Answer

func (v VirtualMachine) Answer(id, answer string) error

Answer answers a pending question.

func (VirtualMachine) BootOptions

BootOptions returns the VirtualMachine's config.bootOptions property.

func (VirtualMachine) Clone

func (v VirtualMachine) Clone(folder *Folder, name string, config types.VirtualMachineCloneSpec) (*Task, error)

func (VirtualMachine) Destroy

func (v VirtualMachine) Destroy() (*Task, error)

func (VirtualMachine) Device

func (v VirtualMachine) Device() (VirtualDeviceList, error)

Device returns the VirtualMachine's config.hardware.device property.

func (VirtualMachine) EditDevice

func (v VirtualMachine) EditDevice(device ...types.BaseVirtualDevice) error

EditDevice edits the given (existing) devices on the VirtualMachine

func (VirtualMachine) PowerOff

func (v VirtualMachine) PowerOff() (*Task, error)

func (VirtualMachine) PowerOn

func (v VirtualMachine) PowerOn() (*Task, error)

func (VirtualMachine) RebootGuest

func (v VirtualMachine) RebootGuest() error

func (VirtualMachine) Reconfigure

func (v VirtualMachine) Reconfigure(config types.VirtualMachineConfigSpec) (*Task, error)

func (VirtualMachine) Reference

func (VirtualMachine) RemoveDevice

func (v VirtualMachine) RemoveDevice(device ...types.BaseVirtualDevice) error

RemoveDevice removes the given devices on the VirtualMachine

func (VirtualMachine) Reset

func (v VirtualMachine) Reset() (*Task, error)

func (VirtualMachine) SetBootOptions

func (v VirtualMachine) SetBootOptions(options *types.VirtualMachineBootOptions) error

SetBootOptions reconfigures the VirtualMachine with the given options.

func (VirtualMachine) ShutdownGuest

func (v VirtualMachine) ShutdownGuest() error

func (VirtualMachine) Suspend

func (v VirtualMachine) Suspend() (*Task, error)

func (VirtualMachine) WaitForIP

func (v VirtualMachine) WaitForIP() (string, error)

type VmwareDistributedVirtualSwitch

type VmwareDistributedVirtualSwitch struct {
	DistributedVirtualSwitch
}

Directories

Path Synopsis
cli
ls
vm
vim25
mo
xml
Package xml implements a simple XML 1.0 parser that understands XML name spaces.
Package xml implements a simple XML 1.0 parser that understands XML name spaces.

Jump to

Keyboard shortcuts

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