Documentation ¶
Overview ¶
Package simulator is a mock framework for the vSphere API.
See also: https://github.com/vmware/govmomi/blob/master/vcsim/README.md
Example ¶
Example of extending the simulator to inject faults.
package main import ( "context" "fmt" "log" "github.com/vmware/govmomi" "github.com/vmware/govmomi/object" "github.com/vmware/govmomi/simulator" "github.com/vmware/govmomi/vim25/methods" "github.com/vmware/govmomi/vim25/soap" "github.com/vmware/govmomi/vim25/types" ) // BusyVM changes the behavior of simulator.VirtualMachine type BusyVM struct { *simulator.VirtualMachine } // Override simulator.VirtualMachine.PowerOffVMTask to inject faults func (vm *BusyVM) PowerOffVMTask(req *types.PowerOffVM_Task) soap.HasFault { task := simulator.CreateTask(req.This, "powerOff", func(*simulator.Task) (types.AnyType, types.BaseMethodFault) { return nil, &types.TaskInProgress{} }) return &methods.PowerOffVM_TaskBody{ Res: &types.PowerOffVM_TaskResponse{ Returnval: task.Run(), }, } } // Add AcquireTicket method, not implemented by simulator.VirtualMachine func (vm *BusyVM) AcquireTicket(req *types.AcquireTicket) soap.HasFault { body := &methods.AcquireTicketBody{} if req.TicketType != "mks" { body.Fault_ = simulator.Fault("", &types.InvalidArgument{}) } body.Res = &types.AcquireTicketResponse{ Returnval: types.VirtualMachineTicket{ Ticket: "welcome 2 the machine", }, } return body } // Example of extending the simulator to inject faults. func main() { ctx := context.Background() model := simulator.VPX() defer model.Remove() _ = model.Create() s := model.Service.NewServer() defer s.Close() // NewClient connects to s.URL over https and invokes 2 SOAP methods (RetrieveServiceContent + Login) c, _ := govmomi.NewClient(ctx, s.URL, true) // Shortcut to choose any VM, rather than using the more verbose Finder or ContainerView. obj := simulator.Map.Any("VirtualMachine").(*simulator.VirtualMachine) // Validate VM is powered on if obj.Runtime.PowerState != "poweredOn" { log.Fatal(obj.Runtime.PowerState) } // Wrap the existing vm object, using the same vm.Self (ManagedObjectReference) value as the Map key. simulator.Map.Put(&BusyVM{obj}) vm := object.NewVirtualMachine(c.Client, obj.Reference()) // Start a PowerOff task using the SOAP client. task, _ := vm.PowerOff(ctx) // Wait for task completion, expecting failure. err := task.Wait(ctx) if err == nil { log.Fatal("expected error") } // Invalid ticket type, expecting failure. _, err = vm.AcquireTicket(ctx, "pks") if err == nil { log.Fatal("expected error") } mks, _ := vm.AcquireTicket(ctx, "mks") fmt.Println(mks.Ticket, obj.Runtime.PowerState) }
Output: welcome 2 the machine poweredOn
Index ¶
- Variables
- func CreateDefaultESX(f *Folder)
- func DisableRuleset(info *types.HostFirewallInfo, id string) bool
- func EnableRuleset(info *types.HostFirewallInfo, id string) bool
- func Fault(msg string, fault types.BaseMethodFault) *soap.Fault
- func FindReference(refs []types.ManagedObjectReference, match ...types.ManagedObjectReference) *types.ManagedObjectReference
- func NewAuthorizationManager(ref types.ManagedObjectReference) object.Reference
- func NewCustomFieldsManager(ref types.ManagedObjectReference) object.Reference
- func NewEventManager(ref types.ManagedObjectReference) object.Reference
- func NewFileManager(ref types.ManagedObjectReference) object.Reference
- func NewHostLocalAccountManager(ref types.ManagedObjectReference) object.Reference
- func NewLicenseManager(ref types.ManagedObjectReference) object.Reference
- func NewOptionManager(ref *types.ManagedObjectReference, setting []types.BaseOptionValue) object.Reference
- func NewPerformanceManager(ref types.ManagedObjectReference) object.Reference
- func NewPropertyCollector(ref types.ManagedObjectReference) object.Reference
- func NewSearchIndex(ref types.ManagedObjectReference) object.Reference
- func NewSessionManager(ref types.ManagedObjectReference) object.Reference
- func NewTaskManager(ref types.ManagedObjectReference) object.Reference
- func NewUserDirectory(ref types.ManagedObjectReference) object.Reference
- func NewVAppConfigSpec() types.VAppConfigSpec
- func NewViewManager(ref types.ManagedObjectReference) object.Reference
- func NewVirtualDiskManager(ref types.ManagedObjectReference) object.Reference
- func RemoveReference(field *[]types.ManagedObjectReference, ref types.ManagedObjectReference)
- func RenameTask(e mo.Entity, r *types.Rename_Task) soap.HasFault
- type AuthorizationManager
- func (m *AuthorizationManager) AddAuthorizationRole(req *types.AddAuthorizationRole) soap.HasFault
- func (m *AuthorizationManager) RemoveAuthorizationRole(req *types.RemoveAuthorizationRole) soap.HasFault
- func (m *AuthorizationManager) RemoveEntityPermission(req *types.RemoveEntityPermission) soap.HasFault
- func (m *AuthorizationManager) RetrieveAllPermissions(req *types.RetrieveAllPermissions) soap.HasFault
- func (m *AuthorizationManager) RetrieveEntityPermissions(req *types.RetrieveEntityPermissions) soap.HasFault
- func (m *AuthorizationManager) RetrieveRolePermissions(req *types.RetrieveRolePermissions) soap.HasFault
- func (m *AuthorizationManager) SetEntityPermissions(req *types.SetEntityPermissions) soap.HasFault
- func (m *AuthorizationManager) UpdateAuthorizationRole(req *types.UpdateAuthorizationRole) soap.HasFault
- type ClusterComputeResource
- type ContainerView
- type Context
- type CustomFieldsManager
- func (c *CustomFieldsManager) AddCustomFieldDef(req *types.AddCustomFieldDef) soap.HasFault
- func (c *CustomFieldsManager) RemoveCustomFieldDef(req *types.RemoveCustomFieldDef) soap.HasFault
- func (c *CustomFieldsManager) RenameCustomFieldDef(req *types.RenameCustomFieldDef) soap.HasFault
- func (c *CustomFieldsManager) SetField(req *types.SetField) soap.HasFault
- type Datacenter
- type Datastore
- type DistributedVirtualPortgroup
- type DistributedVirtualSwitch
- func (s *DistributedVirtualSwitch) AddDVPortgroupTask(c *types.AddDVPortgroup_Task) soap.HasFault
- func (s *DistributedVirtualSwitch) DestroyTask(req *types.Destroy_Task) soap.HasFault
- func (s *DistributedVirtualSwitch) FetchDVPorts(req *types.FetchDVPorts) soap.HasFault
- func (s *DistributedVirtualSwitch) ReconfigureDvsTask(req *types.ReconfigureDvs_Task) soap.HasFault
- type Element
- type EventHistoryCollector
- func (c *EventHistoryCollector) DestroyCollector(ctx *Context, req *types.DestroyCollector) soap.HasFault
- func (c *EventHistoryCollector) Get() mo.Reference
- func (c *EventHistoryCollector) GetLatestPage() []types.BaseEvent
- func (c *EventHistoryCollector) SetCollectorPageSize(ctx *Context, req *types.SetCollectorPageSize) soap.HasFault
- type EventManager
- type FileManager
- func (f *FileManager) CopyDatastoreFileTask(req *types.CopyDatastoreFile_Task) soap.HasFault
- func (f *FileManager) DeleteDatastoreFileTask(req *types.DeleteDatastoreFile_Task) soap.HasFault
- func (f *FileManager) MakeDirectory(req *types.MakeDirectory) soap.HasFault
- func (f *FileManager) MoveDatastoreFileTask(req *types.MoveDatastoreFile_Task) soap.HasFault
- type Folder
- func (f *Folder) AddStandaloneHostTask(a *types.AddStandaloneHost_Task) soap.HasFault
- func (f *Folder) CreateClusterEx(c *types.CreateClusterEx) soap.HasFault
- func (f *Folder) CreateDVSTask(req *types.CreateDVS_Task) soap.HasFault
- func (f *Folder) CreateDatacenter(ctx *Context, c *types.CreateDatacenter) soap.HasFault
- func (f *Folder) CreateFolder(c *types.CreateFolder) soap.HasFault
- func (f *Folder) CreateStoragePod(c *types.CreateStoragePod) soap.HasFault
- func (f *Folder) CreateVMTask(ctx *Context, c *types.CreateVM_Task) soap.HasFault
- func (f *Folder) DestroyTask(req *types.Destroy_Task) soap.HasFault
- func (f *Folder) MoveIntoFolderTask(c *types.MoveIntoFolder_Task) soap.HasFault
- func (f *Folder) RegisterVMTask(ctx *Context, c *types.RegisterVM_Task) soap.HasFault
- func (f *Folder) RenameTask(r *types.Rename_Task) soap.HasFault
- type HostDatastoreBrowser
- type HostDatastoreSystem
- type HostFirewallSystem
- type HostLocalAccountManager
- type HostNetworkSystem
- func (s *HostNetworkSystem) AddPortGroup(c *types.AddPortGroup) soap.HasFault
- func (s *HostNetworkSystem) AddVirtualSwitch(c *types.AddVirtualSwitch) soap.HasFault
- func (s *HostNetworkSystem) RemovePortGroup(c *types.RemovePortGroup) soap.HasFault
- func (s *HostNetworkSystem) RemoveVirtualSwitch(c *types.RemoveVirtualSwitch) soap.HasFault
- func (s *HostNetworkSystem) UpdateNetworkConfig(req *types.UpdateNetworkConfig) soap.HasFault
- type HostSystem
- type IpPool
- type IpPoolManager
- func (m *IpPoolManager) AllocateIpv4Address(req *types.AllocateIpv4Address) soap.HasFault
- func (m *IpPoolManager) AllocateIpv6Address(req *types.AllocateIpv6Address) soap.HasFault
- func (m *IpPoolManager) CreateIpPool(req *types.CreateIpPool) soap.HasFault
- func (m *IpPoolManager) DestroyIpPool(req *types.DestroyIpPool) soap.HasFault
- func (m *IpPoolManager) QueryIPAllocations(req *types.QueryIPAllocations) soap.HasFault
- func (m *IpPoolManager) QueryIpPools(req *types.QueryIpPools) soap.HasFault
- func (m *IpPoolManager) ReleaseIpAllocation(req *types.ReleaseIpAllocation) soap.HasFault
- func (m *IpPoolManager) UpdateIpPool(req *types.UpdateIpPool) soap.HasFault
- type LicenseAssignmentManager
- type LicenseManager
- type ListView
- type Method
- type Model
- type OptionManager
- type PerformanceManager
- func (p *PerformanceManager) QueryAvailablePerfMetric(ctx *Context, req *types.QueryAvailablePerfMetric) soap.HasFault
- func (p *PerformanceManager) QueryPerf(ctx *Context, req *types.QueryPerf) soap.HasFault
- func (p *PerformanceManager) QueryPerfCounter(ctx *Context, req *types.QueryPerfCounter) soap.HasFault
- func (p *PerformanceManager) QueryPerfProviderSummary(ctx *Context, req *types.QueryPerfProviderSummary) soap.HasFault
- type PropertyCollector
- func (pc *PropertyCollector) CancelWaitForUpdates(r *types.CancelWaitForUpdates) soap.HasFault
- func (pc *PropertyCollector) CreateFilter(ctx *Context, c *types.CreateFilter) soap.HasFault
- func (pc *PropertyCollector) CreatePropertyCollector(ctx *Context, c *types.CreatePropertyCollector) soap.HasFault
- func (pc *PropertyCollector) DestroyPropertyCollector(ctx *Context, c *types.DestroyPropertyCollector) soap.HasFault
- func (*PropertyCollector) Lock()
- func (pc *PropertyCollector) PutObject(o mo.Reference)
- func (pc *PropertyCollector) RemoveObject(ref types.ManagedObjectReference)
- func (pc *PropertyCollector) RetrieveProperties(ctx *Context, r *types.RetrieveProperties) soap.HasFault
- func (pc *PropertyCollector) RetrievePropertiesEx(ctx *Context, r *types.RetrievePropertiesEx) soap.HasFault
- func (*PropertyCollector) Unlock()
- func (pc *PropertyCollector) UpdateObject(o mo.Reference, changes []types.PropertyChange)
- func (pc *PropertyCollector) WaitForUpdates(ctx *Context, r *types.WaitForUpdates) soap.HasFault
- func (pc *PropertyCollector) WaitForUpdatesEx(ctx *Context, r *types.WaitForUpdatesEx) soap.HasFault
- type PropertyFilter
- type RegisterObject
- type Registry
- func (r *Registry) AddHandler(h RegisterObject)
- func (r *Registry) AddReference(obj mo.Reference, field *[]types.ManagedObjectReference, ...)
- func (r *Registry) Any(kind string) mo.Entity
- func (r *Registry) AppendReference(obj mo.Reference, field *[]types.ManagedObjectReference, ...)
- func (r *Registry) EventManager() *EventManager
- func (r *Registry) FileManager() *FileManager
- func (r *Registry) FindByName(name string, refs []types.ManagedObjectReference) mo.Entity
- func (r *Registry) Get(ref types.ManagedObjectReference) mo.Reference
- func (r *Registry) IsESX() bool
- func (r *Registry) IsVPX() bool
- func (r *Registry) MarshalJSON() ([]byte, error)
- func (r *Registry) NewEntity(item mo.Entity) mo.Entity
- func (r *Registry) OptionManager() *OptionManager
- func (r *Registry) Put(item mo.Reference) mo.Reference
- func (r *Registry) PutEntity(parent mo.Entity, item mo.Entity) mo.Entity
- func (r *Registry) Remove(item types.ManagedObjectReference)
- func (r *Registry) RemoveReference(obj mo.Reference, field *[]types.ManagedObjectReference, ...)
- func (r *Registry) SearchIndex() *SearchIndex
- func (r *Registry) SessionManager() *SessionManager
- func (r *Registry) Update(obj mo.Reference, changes []types.PropertyChange)
- func (r *Registry) UserDirectory() *UserDirectory
- func (r *Registry) ViewManager() *ViewManager
- func (r *Registry) VirtualDiskManager() *VirtualDiskManager
- func (r *Registry) WithLock(obj mo.Reference, f func())
- type ResourcePool
- func (p *ResourcePool) CreateResourcePool(c *types.CreateResourcePool) soap.HasFault
- func (p *ResourcePool) CreateVApp(req *types.CreateVApp) soap.HasFault
- func (p *ResourcePool) DestroyTask(req *types.Destroy_Task) soap.HasFault
- func (p *ResourcePool) UpdateConfig(c *types.UpdateConfig) soap.HasFault
- type SearchIndex
- func (s *SearchIndex) FindByDatastorePath(r *types.FindByDatastorePath) soap.HasFault
- func (s *SearchIndex) FindByInventoryPath(req *types.FindByInventoryPath) soap.HasFault
- func (s *SearchIndex) FindByUuid(req *types.FindByUuid) soap.HasFault
- func (s *SearchIndex) FindChild(req *types.FindChild) soap.HasFault
- type Server
- type Service
- func (s *Service) About(w http.ResponseWriter, r *http.Request)
- func (s *Service) NewServer() *Server
- func (s *Service) RegisterSDK(r *Registry)
- func (s *Service) RoundTrip(ctx context.Context, request, response soap.HasFault) error
- func (s *Service) ServeDatastore(w http.ResponseWriter, r *http.Request)
- func (s *Service) ServeSDK(w http.ResponseWriter, r *http.Request)
- func (*Service) ServiceVersions(w http.ResponseWriter, r *http.Request)
- type ServiceInstance
- type Session
- type SessionManager
- func (s *SessionManager) AcquireCloneTicket(ctx *Context, _ *types.AcquireCloneTicket) soap.HasFault
- func (s *SessionManager) AcquireGenericServiceTicket(ticket *types.AcquireGenericServiceTicket) soap.HasFault
- func (s *SessionManager) CloneSession(ctx *Context, ticket *types.CloneSession) soap.HasFault
- func (s *SessionManager) Login(ctx *Context, req *types.Login) soap.HasFault
- func (s *SessionManager) LoginByToken(ctx *Context, req *types.LoginByToken) soap.HasFault
- func (s *SessionManager) LoginExtensionByCertificate(ctx *Context, req *types.LoginExtensionByCertificate) soap.HasFault
- func (s *SessionManager) Logout(ctx *Context, _ *types.Logout) soap.HasFault
- func (s *SessionManager) TerminateSession(ctx *Context, req *types.TerminateSession) soap.HasFault
- type StoragePod
- type Task
- type TaskManager
- type TaskRunner
- type UserDirectory
- type ViewManager
- type VirtualApp
- type VirtualDiskManager
- func (m *VirtualDiskManager) CopyVirtualDiskTask(req *types.CopyVirtualDisk_Task) soap.HasFault
- func (m *VirtualDiskManager) CreateVirtualDiskTask(req *types.CreateVirtualDisk_Task) soap.HasFault
- func (m *VirtualDiskManager) DeleteVirtualDiskTask(req *types.DeleteVirtualDisk_Task) soap.HasFault
- func (m *VirtualDiskManager) MoveVirtualDiskTask(req *types.MoveVirtualDisk_Task) soap.HasFault
- func (m *VirtualDiskManager) QueryVirtualDiskUuid(req *types.QueryVirtualDiskUuid) soap.HasFault
- func (m *VirtualDiskManager) SetVirtualDiskUuid(req *types.SetVirtualDiskUuid) soap.HasFault
- type VirtualMachine
- func (vm *VirtualMachine) CloneVMTask(ctx *Context, req *types.CloneVM_Task) soap.HasFault
- func (vm *VirtualMachine) CreateSnapshotTask(req *types.CreateSnapshot_Task) soap.HasFault
- func (vm *VirtualMachine) DestroyTask(ctx *Context, req *types.Destroy_Task) soap.HasFault
- func (vm *VirtualMachine) MarkAsTemplate(req *types.MarkAsTemplate) soap.HasFault
- func (vm *VirtualMachine) PowerOffVMTask(ctx *Context, c *types.PowerOffVM_Task) soap.HasFault
- func (vm *VirtualMachine) PowerOnVMTask(ctx *Context, c *types.PowerOnVM_Task) soap.HasFault
- func (vm *VirtualMachine) ReconfigVMTask(ctx *Context, req *types.ReconfigVM_Task) soap.HasFault
- func (vm *VirtualMachine) RelocateVMTask(req *types.RelocateVM_Task) soap.HasFault
- func (vm *VirtualMachine) RemoveAllSnapshotsTask(req *types.RemoveAllSnapshots_Task) soap.HasFault
- func (vm *VirtualMachine) ResetVMTask(ctx *Context, req *types.ResetVM_Task) soap.HasFault
- func (vm *VirtualMachine) RevertToCurrentSnapshotTask(req *types.RevertToCurrentSnapshot_Task) soap.HasFault
- func (vm *VirtualMachine) ShutdownGuest(ctx *Context, c *types.ShutdownGuest) soap.HasFault
- func (vm *VirtualMachine) SuspendVMTask(ctx *Context, req *types.SuspendVM_Task) soap.HasFault
- func (vm *VirtualMachine) UnregisterVM(ctx *Context, c *types.UnregisterVM) soap.HasFault
- type VirtualMachineSnapshot
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultUserGroup = []*types.UserSearchResult{ {FullName: "root", Group: true, Principal: "root"}, {FullName: "root", Group: false, Principal: "root"}, {FullName: "administrator", Group: false, Principal: "admin"}, }
var EvalLicense = types.LicenseManagerLicenseInfo{ LicenseKey: "00000-00000-00000-00000-00000", EditionKey: "eval", Name: "Evaluation Mode", Properties: []types.KeyAnyValue{ { Key: "feature", Value: types.KeyValue{ Key: "serialuri:2", Value: "Remote virtual Serial Port Concentrator", }, }, { Key: "feature", Value: types.KeyValue{ Key: "dvs", Value: "vSphere Distributed Switch", }, }, }, }
EvalLicense is the default license
var GuestID = []types.VirtualMachineGuestOsIdentifier{}/* 148 elements not displayed */
GuestID is the list of valid types.VirtualMachineGuestOsIdentifier
var Map = NewRegistry()
Map is the default Registry instance.
var Trace = false
Trace when set to true, writes SOAP traffic to stderr
Functions ¶
func CreateDefaultESX ¶
func CreateDefaultESX(f *Folder)
CreateDefaultESX creates a standalone ESX Adds objects of type: Datacenter, Network, ComputeResource, ResourcePool and HostSystem
func DisableRuleset ¶
func DisableRuleset(info *types.HostFirewallInfo, id string) bool
func EnableRuleset ¶
func EnableRuleset(info *types.HostFirewallInfo, id string) bool
func Fault ¶
func Fault(msg string, fault types.BaseMethodFault) *soap.Fault
Fault wraps the given message and fault in a soap.Fault
func FindReference ¶
func FindReference(refs []types.ManagedObjectReference, match ...types.ManagedObjectReference) *types.ManagedObjectReference
FindReference returns the 1st match found in refs, or nil if not found.
func NewAuthorizationManager ¶
func NewAuthorizationManager(ref types.ManagedObjectReference) object.Reference
func NewCustomFieldsManager ¶
func NewCustomFieldsManager(ref types.ManagedObjectReference) object.Reference
func NewEventManager ¶ added in v0.17.0
func NewEventManager(ref types.ManagedObjectReference) object.Reference
func NewFileManager ¶
func NewFileManager(ref types.ManagedObjectReference) object.Reference
func NewHostLocalAccountManager ¶ added in v0.17.0
func NewHostLocalAccountManager(ref types.ManagedObjectReference) object.Reference
func NewLicenseManager ¶
func NewLicenseManager(ref types.ManagedObjectReference) object.Reference
func NewOptionManager ¶
func NewOptionManager(ref *types.ManagedObjectReference, setting []types.BaseOptionValue) object.Reference
func NewPerformanceManager ¶
func NewPerformanceManager(ref types.ManagedObjectReference) object.Reference
func NewPropertyCollector ¶
func NewPropertyCollector(ref types.ManagedObjectReference) object.Reference
func NewSearchIndex ¶
func NewSearchIndex(ref types.ManagedObjectReference) object.Reference
func NewSessionManager ¶
func NewSessionManager(ref types.ManagedObjectReference) object.Reference
func NewTaskManager ¶
func NewTaskManager(ref types.ManagedObjectReference) object.Reference
func NewUserDirectory ¶
func NewUserDirectory(ref types.ManagedObjectReference) object.Reference
func NewVAppConfigSpec ¶
func NewVAppConfigSpec() types.VAppConfigSpec
func NewViewManager ¶
func NewViewManager(ref types.ManagedObjectReference) object.Reference
func NewVirtualDiskManager ¶
func NewVirtualDiskManager(ref types.ManagedObjectReference) object.Reference
func RemoveReference ¶
func RemoveReference(field *[]types.ManagedObjectReference, ref types.ManagedObjectReference)
RemoveReference removes ref from the given field.
func RenameTask ¶
Types ¶
type AuthorizationManager ¶
type AuthorizationManager struct { mo.AuthorizationManager // contains filtered or unexported fields }
func (*AuthorizationManager) AddAuthorizationRole ¶
func (m *AuthorizationManager) AddAuthorizationRole(req *types.AddAuthorizationRole) soap.HasFault
func (*AuthorizationManager) RemoveAuthorizationRole ¶
func (m *AuthorizationManager) RemoveAuthorizationRole(req *types.RemoveAuthorizationRole) soap.HasFault
func (*AuthorizationManager) RemoveEntityPermission ¶
func (m *AuthorizationManager) RemoveEntityPermission(req *types.RemoveEntityPermission) soap.HasFault
func (*AuthorizationManager) RetrieveAllPermissions ¶
func (m *AuthorizationManager) RetrieveAllPermissions(req *types.RetrieveAllPermissions) soap.HasFault
func (*AuthorizationManager) RetrieveEntityPermissions ¶
func (m *AuthorizationManager) RetrieveEntityPermissions(req *types.RetrieveEntityPermissions) soap.HasFault
func (*AuthorizationManager) RetrieveRolePermissions ¶
func (m *AuthorizationManager) RetrieveRolePermissions(req *types.RetrieveRolePermissions) soap.HasFault
func (*AuthorizationManager) SetEntityPermissions ¶
func (m *AuthorizationManager) SetEntityPermissions(req *types.SetEntityPermissions) soap.HasFault
func (*AuthorizationManager) UpdateAuthorizationRole ¶
func (m *AuthorizationManager) UpdateAuthorizationRole(req *types.UpdateAuthorizationRole) soap.HasFault
type ClusterComputeResource ¶
type ClusterComputeResource struct { mo.ClusterComputeResource // contains filtered or unexported fields }
func CreateClusterComputeResource ¶
func CreateClusterComputeResource(f *Folder, name string, spec types.ClusterConfigSpecEx) (*ClusterComputeResource, types.BaseMethodFault)
func (*ClusterComputeResource) AddHostTask ¶
func (c *ClusterComputeResource) AddHostTask(add *types.AddHost_Task) soap.HasFault
func (*ClusterComputeResource) ReconfigureComputeResourceTask ¶ added in v0.17.0
func (c *ClusterComputeResource) ReconfigureComputeResourceTask(req *types.ReconfigureComputeResource_Task) soap.HasFault
type ContainerView ¶
type ContainerView struct { mo.ContainerView // contains filtered or unexported fields }
func (*ContainerView) DestroyView ¶
func (v *ContainerView) DestroyView(ctx *Context, c *types.DestroyView) soap.HasFault
type Context ¶ added in v0.17.0
type Context struct { context.Context Session *Session Header soap.Header Caller *types.ManagedObjectReference Map *Registry // contains filtered or unexported fields }
Context provides per-request Session management.
func (*Context) SetSession ¶ added in v0.17.0
SetSession should be called after successful authentication.
type CustomFieldsManager ¶
type CustomFieldsManager struct { mo.CustomFieldsManager // contains filtered or unexported fields }
func (*CustomFieldsManager) AddCustomFieldDef ¶
func (c *CustomFieldsManager) AddCustomFieldDef(req *types.AddCustomFieldDef) soap.HasFault
func (*CustomFieldsManager) RemoveCustomFieldDef ¶
func (c *CustomFieldsManager) RemoveCustomFieldDef(req *types.RemoveCustomFieldDef) soap.HasFault
func (*CustomFieldsManager) RenameCustomFieldDef ¶
func (c *CustomFieldsManager) RenameCustomFieldDef(req *types.RenameCustomFieldDef) soap.HasFault
type Datacenter ¶ added in v0.17.0
type Datacenter struct { mo.Datacenter // contains filtered or unexported fields }
func NewDatacenter ¶ added in v0.17.0
func NewDatacenter(f *Folder) *Datacenter
NewDatacenter creates a Datacenter and its child folders.
func (*Datacenter) DestroyTask ¶ added in v0.17.1
func (d *Datacenter) DestroyTask(req *types.Destroy_Task) soap.HasFault
func (*Datacenter) PowerOnMultiVMTask ¶ added in v0.17.0
func (dc *Datacenter) PowerOnMultiVMTask(ctx *Context, req *types.PowerOnMultiVM_Task) soap.HasFault
type Datastore ¶
func (*Datastore) RefreshDatastore ¶
func (ds *Datastore) RefreshDatastore(*types.RefreshDatastore) soap.HasFault
type DistributedVirtualPortgroup ¶
type DistributedVirtualPortgroup struct {
mo.DistributedVirtualPortgroup
}
func (*DistributedVirtualPortgroup) DestroyTask ¶
func (s *DistributedVirtualPortgroup) DestroyTask(req *types.Destroy_Task) soap.HasFault
func (*DistributedVirtualPortgroup) ReconfigureDVPortgroupTask ¶
func (s *DistributedVirtualPortgroup) ReconfigureDVPortgroupTask(req *types.ReconfigureDVPortgroup_Task) soap.HasFault
type DistributedVirtualSwitch ¶
type DistributedVirtualSwitch struct {
mo.DistributedVirtualSwitch
}
func (*DistributedVirtualSwitch) AddDVPortgroupTask ¶
func (s *DistributedVirtualSwitch) AddDVPortgroupTask(c *types.AddDVPortgroup_Task) soap.HasFault
func (*DistributedVirtualSwitch) DestroyTask ¶
func (s *DistributedVirtualSwitch) DestroyTask(req *types.Destroy_Task) soap.HasFault
func (*DistributedVirtualSwitch) FetchDVPorts ¶
func (s *DistributedVirtualSwitch) FetchDVPorts(req *types.FetchDVPorts) soap.HasFault
func (*DistributedVirtualSwitch) ReconfigureDvsTask ¶
func (s *DistributedVirtualSwitch) ReconfigureDvsTask(req *types.ReconfigureDvs_Task) soap.HasFault
type Element ¶ added in v0.18.0
type Element struct {
// contains filtered or unexported fields
}
Element can be used to defer decoding of an XML node.
func (*Element) UnmarshalXML ¶ added in v0.18.0
type EventHistoryCollector ¶ added in v0.17.0
type EventHistoryCollector struct { mo.EventHistoryCollector // contains filtered or unexported fields }
func (*EventHistoryCollector) DestroyCollector ¶ added in v0.17.0
func (c *EventHistoryCollector) DestroyCollector(ctx *Context, req *types.DestroyCollector) soap.HasFault
func (*EventHistoryCollector) Get ¶ added in v0.17.0
func (c *EventHistoryCollector) Get() mo.Reference
func (*EventHistoryCollector) GetLatestPage ¶ added in v0.17.1
func (c *EventHistoryCollector) GetLatestPage() []types.BaseEvent
func (*EventHistoryCollector) SetCollectorPageSize ¶ added in v0.17.0
func (c *EventHistoryCollector) SetCollectorPageSize(ctx *Context, req *types.SetCollectorPageSize) soap.HasFault
type EventManager ¶ added in v0.17.0
type EventManager struct { mo.EventManager // contains filtered or unexported fields }
func (*EventManager) CreateCollectorForEvents ¶ added in v0.17.0
func (m *EventManager) CreateCollectorForEvents(ctx *Context, req *types.CreateCollectorForEvents) soap.HasFault
func (*EventManager) QueryEvents ¶ added in v0.17.1
func (m *EventManager) QueryEvents(ctx *Context, req *types.QueryEvents) soap.HasFault
type FileManager ¶
type FileManager struct {
mo.FileManager
}
func (*FileManager) CopyDatastoreFileTask ¶
func (f *FileManager) CopyDatastoreFileTask(req *types.CopyDatastoreFile_Task) soap.HasFault
func (*FileManager) DeleteDatastoreFileTask ¶
func (f *FileManager) DeleteDatastoreFileTask(req *types.DeleteDatastoreFile_Task) soap.HasFault
func (*FileManager) MakeDirectory ¶
func (f *FileManager) MakeDirectory(req *types.MakeDirectory) soap.HasFault
func (*FileManager) MoveDatastoreFileTask ¶
func (f *FileManager) MoveDatastoreFileTask(req *types.MoveDatastoreFile_Task) soap.HasFault
type Folder ¶
func (*Folder) AddStandaloneHostTask ¶
func (f *Folder) AddStandaloneHostTask(a *types.AddStandaloneHost_Task) soap.HasFault
func (*Folder) CreateClusterEx ¶
func (f *Folder) CreateClusterEx(c *types.CreateClusterEx) soap.HasFault
func (*Folder) CreateDVSTask ¶
func (f *Folder) CreateDVSTask(req *types.CreateDVS_Task) soap.HasFault
func (*Folder) CreateDatacenter ¶
func (*Folder) CreateFolder ¶
func (f *Folder) CreateFolder(c *types.CreateFolder) soap.HasFault
func (*Folder) CreateStoragePod ¶
func (f *Folder) CreateStoragePod(c *types.CreateStoragePod) soap.HasFault
func (*Folder) CreateVMTask ¶
func (*Folder) DestroyTask ¶ added in v0.17.1
func (f *Folder) DestroyTask(req *types.Destroy_Task) soap.HasFault
func (*Folder) MoveIntoFolderTask ¶
func (f *Folder) MoveIntoFolderTask(c *types.MoveIntoFolder_Task) soap.HasFault
func (*Folder) RegisterVMTask ¶
func (*Folder) RenameTask ¶
func (f *Folder) RenameTask(r *types.Rename_Task) soap.HasFault
type HostDatastoreBrowser ¶
type HostDatastoreBrowser struct {
mo.HostDatastoreBrowser
}
func (*HostDatastoreBrowser) SearchDatastoreSubFoldersTask ¶
func (b *HostDatastoreBrowser) SearchDatastoreSubFoldersTask(s *types.SearchDatastoreSubFolders_Task) soap.HasFault
func (*HostDatastoreBrowser) SearchDatastoreTask ¶
func (b *HostDatastoreBrowser) SearchDatastoreTask(s *types.SearchDatastore_Task) soap.HasFault
type HostDatastoreSystem ¶
type HostDatastoreSystem struct { mo.HostDatastoreSystem Host *mo.HostSystem }
func (*HostDatastoreSystem) CreateLocalDatastore ¶
func (dss *HostDatastoreSystem) CreateLocalDatastore(c *types.CreateLocalDatastore) soap.HasFault
func (*HostDatastoreSystem) CreateNasDatastore ¶
func (dss *HostDatastoreSystem) CreateNasDatastore(c *types.CreateNasDatastore) soap.HasFault
type HostFirewallSystem ¶
type HostFirewallSystem struct {
mo.HostFirewallSystem
}
func NewHostFirewallSystem ¶
func NewHostFirewallSystem(_ *mo.HostSystem) *HostFirewallSystem
func (*HostFirewallSystem) DisableRuleset ¶
func (s *HostFirewallSystem) DisableRuleset(req *types.DisableRuleset) soap.HasFault
func (*HostFirewallSystem) EnableRuleset ¶
func (s *HostFirewallSystem) EnableRuleset(req *types.EnableRuleset) soap.HasFault
type HostLocalAccountManager ¶ added in v0.17.0
type HostLocalAccountManager struct {
mo.HostLocalAccountManager
}
func (*HostLocalAccountManager) CreateUser ¶ added in v0.17.0
func (h *HostLocalAccountManager) CreateUser(req *types.CreateUser) soap.HasFault
func (*HostLocalAccountManager) RemoveUser ¶ added in v0.17.0
func (h *HostLocalAccountManager) RemoveUser(req *types.RemoveUser) soap.HasFault
func (*HostLocalAccountManager) UpdateUser ¶ added in v0.17.0
func (h *HostLocalAccountManager) UpdateUser(req *types.UpdateUser) soap.HasFault
type HostNetworkSystem ¶
type HostNetworkSystem struct { mo.HostNetworkSystem Host *mo.HostSystem }
func NewHostNetworkSystem ¶
func NewHostNetworkSystem(host *mo.HostSystem) *HostNetworkSystem
func (*HostNetworkSystem) AddPortGroup ¶
func (s *HostNetworkSystem) AddPortGroup(c *types.AddPortGroup) soap.HasFault
func (*HostNetworkSystem) AddVirtualSwitch ¶
func (s *HostNetworkSystem) AddVirtualSwitch(c *types.AddVirtualSwitch) soap.HasFault
func (*HostNetworkSystem) RemovePortGroup ¶
func (s *HostNetworkSystem) RemovePortGroup(c *types.RemovePortGroup) soap.HasFault
func (*HostNetworkSystem) RemoveVirtualSwitch ¶
func (s *HostNetworkSystem) RemoveVirtualSwitch(c *types.RemoveVirtualSwitch) soap.HasFault
func (*HostNetworkSystem) UpdateNetworkConfig ¶
func (s *HostNetworkSystem) UpdateNetworkConfig(req *types.UpdateNetworkConfig) soap.HasFault
type HostSystem ¶
type HostSystem struct {
mo.HostSystem
}
func CreateStandaloneHost ¶
func CreateStandaloneHost(f *Folder, spec types.HostConnectSpec) (*HostSystem, types.BaseMethodFault)
CreateStandaloneHost uses esx.HostSystem as a template, applying the given spec and creating the ComputeResource parent and ResourcePool sibling.
func NewHostSystem ¶
func NewHostSystem(host mo.HostSystem) *HostSystem
func (*HostSystem) DestroyTask ¶ added in v0.17.0
func (h *HostSystem) DestroyTask(req *types.Destroy_Task) soap.HasFault
func (*HostSystem) EnterMaintenanceModeTask ¶
func (h *HostSystem) EnterMaintenanceModeTask(spec *types.EnterMaintenanceMode_Task) soap.HasFault
func (*HostSystem) ExitMaintenanceModeTask ¶
func (h *HostSystem) ExitMaintenanceModeTask(spec *types.ExitMaintenanceMode_Task) soap.HasFault
type IpPool ¶
type IpPool struct {
// contains filtered or unexported fields
}
func MustNewIpPool ¶
func (*IpPool) ReleaseIpv4 ¶
func (*IpPool) ReleaseIpv6 ¶
type IpPoolManager ¶
type IpPoolManager struct { mo.IpPoolManager // contains filtered or unexported fields }
IpPoolManager implements a simple IP Pool manager in which all pools are shared across different datacenters.
func NewIpPoolManager ¶
func NewIpPoolManager(ref types.ManagedObjectReference) *IpPoolManager
func (*IpPoolManager) AllocateIpv4Address ¶
func (m *IpPoolManager) AllocateIpv4Address(req *types.AllocateIpv4Address) soap.HasFault
func (*IpPoolManager) AllocateIpv6Address ¶
func (m *IpPoolManager) AllocateIpv6Address(req *types.AllocateIpv6Address) soap.HasFault
func (*IpPoolManager) CreateIpPool ¶
func (m *IpPoolManager) CreateIpPool(req *types.CreateIpPool) soap.HasFault
func (*IpPoolManager) DestroyIpPool ¶
func (m *IpPoolManager) DestroyIpPool(req *types.DestroyIpPool) soap.HasFault
func (*IpPoolManager) QueryIPAllocations ¶
func (m *IpPoolManager) QueryIPAllocations(req *types.QueryIPAllocations) soap.HasFault
func (*IpPoolManager) QueryIpPools ¶
func (m *IpPoolManager) QueryIpPools(req *types.QueryIpPools) soap.HasFault
func (*IpPoolManager) ReleaseIpAllocation ¶
func (m *IpPoolManager) ReleaseIpAllocation(req *types.ReleaseIpAllocation) soap.HasFault
func (*IpPoolManager) UpdateIpPool ¶
func (m *IpPoolManager) UpdateIpPool(req *types.UpdateIpPool) soap.HasFault
type LicenseAssignmentManager ¶
type LicenseAssignmentManager struct {
mo.LicenseAssignmentManager
}
func (*LicenseAssignmentManager) QueryAssignedLicenses ¶
func (m *LicenseAssignmentManager) QueryAssignedLicenses(req *types.QueryAssignedLicenses) soap.HasFault
type LicenseManager ¶
type LicenseManager struct {
mo.LicenseManager
}
func (*LicenseManager) AddLicense ¶
func (m *LicenseManager) AddLicense(req *types.AddLicense) soap.HasFault
func (*LicenseManager) RemoveLicense ¶
func (m *LicenseManager) RemoveLicense(req *types.RemoveLicense) soap.HasFault
type ListView ¶ added in v0.19.0
func (*ListView) DestroyView ¶ added in v0.19.0
func (*ListView) ModifyListView ¶ added in v0.19.0
func (v *ListView) ModifyListView(req *types.ModifyListView) soap.HasFault
func (*ListView) ResetListView ¶ added in v0.19.0
func (v *ListView) ResetListView(req *types.ResetListView) soap.HasFault
type Method ¶
type Method struct { Name string This types.ManagedObjectReference Header soap.Header Body types.AnyType }
Method encapsulates a decoded SOAP client request
type Model ¶
type Model struct { Service *Service `json:"-"` ServiceContent types.ServiceContent `json:"-"` RootFolder mo.Folder `json:"-"` // Autostart will power on Model created VMs when true Autostart bool `json:"-"` // Datacenter specifies the number of Datacenter entities to create Datacenter int // Portgroup specifies the number of DistributedVirtualPortgroup entities to create per Datacenter Portgroup int // Host specifies the number of standalone HostSystems entities to create per Datacenter Host int `json:",omitempty"` // Cluster specifies the number of ClusterComputeResource entities to create per Datacenter Cluster int // ClusterHost specifies the number of HostSystems entities to create within a Cluster ClusterHost int `json:",omitempty"` // Pool specifies the number of ResourcePool entities to create per Cluster Pool int // Datastore specifies the number of Datastore entities to create // Each Datastore will have temporary local file storage and will be mounted // on every HostSystem created by the ModelConfig Datastore int // Machine specifies the number of VirtualMachine entities to create per ResourcePool Machine int // Folder specifies the number of Datacenter to place within a Folder. // This includes a folder for the Datacenter itself and its host, vm, network and datastore folders. // All resources for the Datacenter are placed within these folders, rather than the top-level folders. Folder int // App specifies the number of VirtualApp to create per Cluster App int // Pod specifies the number of StoragePod to create per Cluster Pod int // contains filtered or unexported fields }
Model is used to populate a Model with an initial set of managed entities. This is a simple helper for tests running against a simulator, to populate an inventory with commonly used models.
Example ¶
Example for starting a simulator with empty inventory, similar to a fresh install of vCenter.
package main import ( "context" "fmt" "log" "github.com/vmware/govmomi" "github.com/vmware/govmomi/simulator" ) func main() { ctx := context.Background() model := simulator.VPX() model.Datacenter = 0 // No DC == no inventory defer model.Remove() err := model.Create() if err != nil { log.Fatal(err) } s := model.Service.NewServer() defer s.Close() c, _ := govmomi.NewClient(ctx, s.URL, true) fmt.Printf("%s with %d hosts", c.Client.ServiceContent.About.ApiType, model.Count().Host) }
Output: VirtualCenter with 0 hosts
func ESX ¶
func ESX() *Model
ESX is the default Model for a standalone ESX instance
Example ¶
Example boilerplate for starting a simulator initialized with an ESX model.
package main import ( "context" "fmt" "log" "github.com/vmware/govmomi" "github.com/vmware/govmomi/simulator" ) func main() { ctx := context.Background() // ESXi model + initial set of objects (VMs, network, datastore) model := simulator.ESX() defer model.Remove() err := model.Create() if err != nil { log.Fatal(err) } s := model.Service.NewServer() defer s.Close() c, _ := govmomi.NewClient(ctx, s.URL, true) fmt.Printf("%s with %d host", c.Client.ServiceContent.About.ApiType, model.Count().Host) }
Output: HostAgent with 1 host
func VPX ¶
func VPX() *Model
VPX is the default Model for a vCenter instance
Example ¶
Example boilerplate for starting a simulator initialized with a vCenter model.
package main import ( "context" "fmt" "log" "github.com/vmware/govmomi" "github.com/vmware/govmomi/simulator" ) func main() { ctx := context.Background() // vCenter model + initial set of objects (cluster, hosts, VMs, network, datastore, etc) model := simulator.VPX() defer model.Remove() err := model.Create() if err != nil { log.Fatal(err) } s := model.Service.NewServer() defer s.Close() c, _ := govmomi.NewClient(ctx, s.URL, true) fmt.Printf("%s with %d hosts", c.Client.ServiceContent.About.ApiType, model.Count().Host) }
Output: VirtualCenter with 4 hosts
type OptionManager ¶
type OptionManager struct {
mo.OptionManager
}
func (*OptionManager) QueryOptions ¶
func (m *OptionManager) QueryOptions(req *types.QueryOptions) soap.HasFault
func (*OptionManager) UpdateOptions ¶ added in v0.17.0
func (m *OptionManager) UpdateOptions(req *types.UpdateOptions) soap.HasFault
type PerformanceManager ¶
type PerformanceManager struct { mo.PerformanceManager // contains filtered or unexported fields }
func (*PerformanceManager) QueryAvailablePerfMetric ¶ added in v0.19.0
func (p *PerformanceManager) QueryAvailablePerfMetric(ctx *Context, req *types.QueryAvailablePerfMetric) soap.HasFault
func (*PerformanceManager) QueryPerfCounter ¶ added in v0.19.0
func (p *PerformanceManager) QueryPerfCounter(ctx *Context, req *types.QueryPerfCounter) soap.HasFault
func (*PerformanceManager) QueryPerfProviderSummary ¶ added in v0.19.0
func (p *PerformanceManager) QueryPerfProviderSummary(ctx *Context, req *types.QueryPerfProviderSummary) soap.HasFault
type PropertyCollector ¶
type PropertyCollector struct { mo.PropertyCollector // contains filtered or unexported fields }
func (*PropertyCollector) CancelWaitForUpdates ¶
func (pc *PropertyCollector) CancelWaitForUpdates(r *types.CancelWaitForUpdates) soap.HasFault
func (*PropertyCollector) CreateFilter ¶
func (pc *PropertyCollector) CreateFilter(ctx *Context, c *types.CreateFilter) soap.HasFault
func (*PropertyCollector) CreatePropertyCollector ¶
func (pc *PropertyCollector) CreatePropertyCollector(ctx *Context, c *types.CreatePropertyCollector) soap.HasFault
func (*PropertyCollector) DestroyPropertyCollector ¶
func (pc *PropertyCollector) DestroyPropertyCollector(ctx *Context, c *types.DestroyPropertyCollector) soap.HasFault
func (*PropertyCollector) PutObject ¶ added in v0.19.0
func (pc *PropertyCollector) PutObject(o mo.Reference)
func (*PropertyCollector) RemoveObject ¶ added in v0.19.0
func (pc *PropertyCollector) RemoveObject(ref types.ManagedObjectReference)
func (*PropertyCollector) RetrieveProperties ¶
func (pc *PropertyCollector) RetrieveProperties(ctx *Context, r *types.RetrieveProperties) soap.HasFault
RetrieveProperties is deprecated, but govmomi is still using it at the moment.
func (*PropertyCollector) RetrievePropertiesEx ¶
func (pc *PropertyCollector) RetrievePropertiesEx(ctx *Context, r *types.RetrievePropertiesEx) soap.HasFault
func (*PropertyCollector) UpdateObject ¶ added in v0.19.0
func (pc *PropertyCollector) UpdateObject(o mo.Reference, changes []types.PropertyChange)
func (*PropertyCollector) WaitForUpdates ¶
func (pc *PropertyCollector) WaitForUpdates(ctx *Context, r *types.WaitForUpdates) soap.HasFault
WaitForUpdates is deprecated, but pyvmomi is still using it at the moment.
func (*PropertyCollector) WaitForUpdatesEx ¶
func (pc *PropertyCollector) WaitForUpdatesEx(ctx *Context, r *types.WaitForUpdatesEx) soap.HasFault
type PropertyFilter ¶
type PropertyFilter struct { mo.PropertyFilter // contains filtered or unexported fields }
func (*PropertyFilter) DestroyPropertyFilter ¶
func (f *PropertyFilter) DestroyPropertyFilter(ctx *Context, c *types.DestroyPropertyFilter) soap.HasFault
type RegisterObject ¶
type RegisterObject interface { mo.Reference PutObject(mo.Reference) UpdateObject(mo.Reference, []types.PropertyChange) RemoveObject(types.ManagedObjectReference) }
RegisterObject interface supports callbacks when objects are created, updated and deleted from the Registry
type Registry ¶
Registry manages a map of mo.Reference objects
func (*Registry) AddHandler ¶
func (r *Registry) AddHandler(h RegisterObject)
AddHandler adds a RegisterObject handler to the Registry.
func (*Registry) AddReference ¶ added in v0.17.0
func (r *Registry) AddReference(obj mo.Reference, field *[]types.ManagedObjectReference, ref types.ManagedObjectReference)
AddReference appends ref to field if not already in the given field.
func (*Registry) AppendReference ¶ added in v0.17.0
func (r *Registry) AppendReference(obj mo.Reference, field *[]types.ManagedObjectReference, ref ...types.ManagedObjectReference)
AppendReference appends the given refs to field.
func (*Registry) EventManager ¶ added in v0.17.0
func (r *Registry) EventManager() *EventManager
EventManager returns the EventManager singleton
func (*Registry) FileManager ¶
func (r *Registry) FileManager() *FileManager
FileManager returns the FileManager singleton
func (*Registry) FindByName ¶
FindByName returns the first mo.Entity of the given refs whose Name field is equal to the given name. If there is no match, nil is returned. This method is useful for cases where objects are required to have a unique name, such as Datastore with a HostStorageSystem or HostSystem within a ClusterComputeResource.
func (*Registry) Get ¶
func (r *Registry) Get(ref types.ManagedObjectReference) mo.Reference
Get returns the object for the given reference.
func (*Registry) MarshalJSON ¶ added in v0.17.0
func (*Registry) NewEntity ¶
NewEntity sets Entity().Self with a new, unique Value. Useful for creating object instances from templates.
func (*Registry) OptionManager ¶ added in v0.18.0
func (r *Registry) OptionManager() *OptionManager
OptionManager returns the OptionManager singleton
func (*Registry) Put ¶
Put adds a new object to Registry, generating a ManagedObjectReference if not already set.
func (*Registry) PutEntity ¶
PutEntity sets item.Parent to that of parent.Self before adding item to the Registry.
func (*Registry) Remove ¶
func (r *Registry) Remove(item types.ManagedObjectReference)
Remove removes an object from the Registry.
func (*Registry) RemoveReference ¶ added in v0.17.0
func (r *Registry) RemoveReference(obj mo.Reference, field *[]types.ManagedObjectReference, ref types.ManagedObjectReference)
RemoveReference removes ref from the given field.
func (*Registry) SearchIndex ¶
func (r *Registry) SearchIndex() *SearchIndex
SearchIndex returns the SearchIndex singleton
func (*Registry) SessionManager ¶ added in v0.17.0
func (r *Registry) SessionManager() *SessionManager
SessionManager returns the SessionManager singleton
func (*Registry) Update ¶ added in v0.19.0
func (r *Registry) Update(obj mo.Reference, changes []types.PropertyChange)
Update dispatches object property changes to RegisterObject handlers, such as any PropertyCollector instances with in-progress WaitForUpdates calls. The changes are also applied to the given object via mo.ApplyPropertyChange, so there is no need to set object fields directly.
func (*Registry) UserDirectory ¶ added in v0.17.0
func (r *Registry) UserDirectory() *UserDirectory
UserDirectory returns the UserDirectory singleton
func (*Registry) ViewManager ¶
func (r *Registry) ViewManager() *ViewManager
ViewManager returns the ViewManager singleton
func (*Registry) VirtualDiskManager ¶
func (r *Registry) VirtualDiskManager() *VirtualDiskManager
VirtualDiskManager returns the VirtualDiskManager singleton
type ResourcePool ¶
type ResourcePool struct {
mo.ResourcePool
}
func NewResourcePool ¶
func NewResourcePool() *ResourcePool
func (*ResourcePool) CreateResourcePool ¶
func (p *ResourcePool) CreateResourcePool(c *types.CreateResourcePool) soap.HasFault
func (*ResourcePool) CreateVApp ¶
func (p *ResourcePool) CreateVApp(req *types.CreateVApp) soap.HasFault
func (*ResourcePool) DestroyTask ¶
func (p *ResourcePool) DestroyTask(req *types.Destroy_Task) soap.HasFault
func (*ResourcePool) UpdateConfig ¶
func (p *ResourcePool) UpdateConfig(c *types.UpdateConfig) soap.HasFault
type SearchIndex ¶
type SearchIndex struct {
mo.SearchIndex
}
func (*SearchIndex) FindByDatastorePath ¶
func (s *SearchIndex) FindByDatastorePath(r *types.FindByDatastorePath) soap.HasFault
func (*SearchIndex) FindByInventoryPath ¶
func (s *SearchIndex) FindByInventoryPath(req *types.FindByInventoryPath) soap.HasFault
func (*SearchIndex) FindByUuid ¶
func (s *SearchIndex) FindByUuid(req *types.FindByUuid) soap.HasFault
type Server ¶
type Server struct { *httptest.Server URL *url.URL Tunnel int // contains filtered or unexported fields }
Server provides a simulator Service over HTTP
func (*Server) Certificate ¶
func (s *Server) Certificate() *x509.Certificate
Certificate returns the TLS certificate for the Server if started with TLS enabled. This method will panic if TLS is not enabled for the server.
func (*Server) CertificateFile ¶
CertificateFile returns a file name, where the file contains the PEM encoded Server.Certificate. The temporary file is removed when Server.Close() is called.
func (*Server) CertificateInfo ¶
func (s *Server) CertificateInfo() *object.HostCertificateInfo
CertificateInfo returns Server.Certificate() as object.HostCertificateInfo
func (*Server) Close ¶
func (s *Server) Close()
Close shuts down the server and blocks until all outstanding requests on this server have completed.
func (*Server) StartTunnel ¶ added in v0.18.0
StartTunnel runs an HTTP proxy for tunneling SDK requests that require TLS client certificate authentication.
type Service ¶
type Service struct { TLS *tls.Config ServeMux *http.ServeMux // contains filtered or unexported fields }
Service decodes incoming requests and dispatches to a Handler
func New ¶
func New(instance *ServiceInstance) *Service
New returns an initialized simulator Service instance
func (*Service) About ¶
func (s *Service) About(w http.ResponseWriter, r *http.Request)
About generates some info about the simulator.
func (*Service) RegisterSDK ¶ added in v0.18.0
RegisterSDK adds an HTTP handler for the Registry's Path and Namespace.
func (*Service) RoundTrip ¶
RoundTrip implements the soap.RoundTripper interface in process. Rather than encode/decode SOAP over HTTP, this implementation uses reflection.
func (*Service) ServeDatastore ¶
func (s *Service) ServeDatastore(w http.ResponseWriter, r *http.Request)
ServeDatastore handler for Datastore access via /folder path.
func (*Service) ServeSDK ¶
func (s *Service) ServeSDK(w http.ResponseWriter, r *http.Request)
ServeSDK implements the http.Handler interface
func (*Service) ServiceVersions ¶
func (*Service) ServiceVersions(w http.ResponseWriter, r *http.Request)
ServiceVersions handler for the /sdk/vimServiceVersions.xml path.
type ServiceInstance ¶
type ServiceInstance struct {
mo.ServiceInstance
}
func NewServiceInstance ¶
func NewServiceInstance(content types.ServiceContent, folder mo.Folder) *ServiceInstance
func (*ServiceInstance) CurrentTime ¶
func (*ServiceInstance) CurrentTime(*types.CurrentTime) soap.HasFault
func (*ServiceInstance) RetrieveServiceContent ¶
func (s *ServiceInstance) RetrieveServiceContent(*types.RetrieveServiceContent) soap.HasFault
type Session ¶ added in v0.17.0
type Session struct { types.UserSession *Registry }
Session combines a UserSession and a Registry for per-session managed objects.
type SessionManager ¶
type SessionManager struct { mo.SessionManager ServiceHostName string // contains filtered or unexported fields }
func (*SessionManager) AcquireCloneTicket ¶ added in v0.17.0
func (s *SessionManager) AcquireCloneTicket(ctx *Context, _ *types.AcquireCloneTicket) soap.HasFault
func (*SessionManager) AcquireGenericServiceTicket ¶
func (s *SessionManager) AcquireGenericServiceTicket(ticket *types.AcquireGenericServiceTicket) soap.HasFault
func (*SessionManager) CloneSession ¶ added in v0.17.0
func (s *SessionManager) CloneSession(ctx *Context, ticket *types.CloneSession) soap.HasFault
func (*SessionManager) LoginByToken ¶ added in v0.18.0
func (s *SessionManager) LoginByToken(ctx *Context, req *types.LoginByToken) soap.HasFault
func (*SessionManager) LoginExtensionByCertificate ¶ added in v0.18.0
func (s *SessionManager) LoginExtensionByCertificate(ctx *Context, req *types.LoginExtensionByCertificate) soap.HasFault
func (*SessionManager) TerminateSession ¶ added in v0.17.0
func (s *SessionManager) TerminateSession(ctx *Context, req *types.TerminateSession) soap.HasFault
type StoragePod ¶
type StoragePod struct {
mo.StoragePod
}
StoragePod aka "Datastore Cluster"
func (*StoragePod) MoveIntoFolderTask ¶
func (p *StoragePod) MoveIntoFolderTask(c *types.MoveIntoFolder_Task) soap.HasFault
type Task ¶
func CreateTask ¶
func NewTask ¶
func NewTask(runner TaskRunner) *Task
func (*Task) Run ¶
func (t *Task) Run() types.ManagedObjectReference
type TaskManager ¶
type TaskManager struct { mo.TaskManager sync.Mutex }
func (*TaskManager) PutObject ¶
func (m *TaskManager) PutObject(obj mo.Reference)
func (*TaskManager) RemoveObject ¶
func (*TaskManager) RemoveObject(types.ManagedObjectReference)
func (*TaskManager) UpdateObject ¶ added in v0.19.0
func (*TaskManager) UpdateObject(mo.Reference, []types.PropertyChange)
type TaskRunner ¶
type UserDirectory ¶
type UserDirectory struct { mo.UserDirectory // contains filtered or unexported fields }
func (*UserDirectory) RetrieveUserGroups ¶
func (u *UserDirectory) RetrieveUserGroups(req *types.RetrieveUserGroups) soap.HasFault
type ViewManager ¶
type ViewManager struct { mo.ViewManager // contains filtered or unexported fields }
func (*ViewManager) CreateContainerView ¶
func (m *ViewManager) CreateContainerView(ctx *Context, req *types.CreateContainerView) soap.HasFault
func (*ViewManager) CreateListView ¶ added in v0.19.0
func (m *ViewManager) CreateListView(ctx *Context, req *types.CreateListView) soap.HasFault
type VirtualApp ¶
type VirtualApp struct {
mo.VirtualApp
}
func (*VirtualApp) CreateChildVMTask ¶
func (a *VirtualApp) CreateChildVMTask(ctx *Context, req *types.CreateChildVM_Task) soap.HasFault
func (*VirtualApp) DestroyTask ¶
func (a *VirtualApp) DestroyTask(req *types.Destroy_Task) soap.HasFault
type VirtualDiskManager ¶
type VirtualDiskManager struct {
mo.VirtualDiskManager
}
func (*VirtualDiskManager) CopyVirtualDiskTask ¶
func (m *VirtualDiskManager) CopyVirtualDiskTask(req *types.CopyVirtualDisk_Task) soap.HasFault
func (*VirtualDiskManager) CreateVirtualDiskTask ¶
func (m *VirtualDiskManager) CreateVirtualDiskTask(req *types.CreateVirtualDisk_Task) soap.HasFault
func (*VirtualDiskManager) DeleteVirtualDiskTask ¶
func (m *VirtualDiskManager) DeleteVirtualDiskTask(req *types.DeleteVirtualDisk_Task) soap.HasFault
func (*VirtualDiskManager) MoveVirtualDiskTask ¶
func (m *VirtualDiskManager) MoveVirtualDiskTask(req *types.MoveVirtualDisk_Task) soap.HasFault
func (*VirtualDiskManager) QueryVirtualDiskUuid ¶ added in v0.17.0
func (m *VirtualDiskManager) QueryVirtualDiskUuid(req *types.QueryVirtualDiskUuid) soap.HasFault
func (*VirtualDiskManager) SetVirtualDiskUuid ¶ added in v0.18.0
func (m *VirtualDiskManager) SetVirtualDiskUuid(req *types.SetVirtualDiskUuid) soap.HasFault
type VirtualMachine ¶
type VirtualMachine struct { mo.VirtualMachine // contains filtered or unexported fields }
func NewVirtualMachine ¶
func NewVirtualMachine(parent types.ManagedObjectReference, spec *types.VirtualMachineConfigSpec) (*VirtualMachine, types.BaseMethodFault)
func (*VirtualMachine) CloneVMTask ¶
func (vm *VirtualMachine) CloneVMTask(ctx *Context, req *types.CloneVM_Task) soap.HasFault
func (*VirtualMachine) CreateSnapshotTask ¶
func (vm *VirtualMachine) CreateSnapshotTask(req *types.CreateSnapshot_Task) soap.HasFault
func (*VirtualMachine) DestroyTask ¶
func (vm *VirtualMachine) DestroyTask(ctx *Context, req *types.Destroy_Task) soap.HasFault
func (*VirtualMachine) MarkAsTemplate ¶ added in v0.17.0
func (vm *VirtualMachine) MarkAsTemplate(req *types.MarkAsTemplate) soap.HasFault
func (*VirtualMachine) PowerOffVMTask ¶
func (vm *VirtualMachine) PowerOffVMTask(ctx *Context, c *types.PowerOffVM_Task) soap.HasFault
func (*VirtualMachine) PowerOnVMTask ¶
func (vm *VirtualMachine) PowerOnVMTask(ctx *Context, c *types.PowerOnVM_Task) soap.HasFault
func (*VirtualMachine) ReconfigVMTask ¶
func (vm *VirtualMachine) ReconfigVMTask(ctx *Context, req *types.ReconfigVM_Task) soap.HasFault
func (*VirtualMachine) RelocateVMTask ¶
func (vm *VirtualMachine) RelocateVMTask(req *types.RelocateVM_Task) soap.HasFault
func (*VirtualMachine) RemoveAllSnapshotsTask ¶
func (vm *VirtualMachine) RemoveAllSnapshotsTask(req *types.RemoveAllSnapshots_Task) soap.HasFault
func (*VirtualMachine) ResetVMTask ¶ added in v0.19.0
func (vm *VirtualMachine) ResetVMTask(ctx *Context, req *types.ResetVM_Task) soap.HasFault
func (*VirtualMachine) RevertToCurrentSnapshotTask ¶
func (vm *VirtualMachine) RevertToCurrentSnapshotTask(req *types.RevertToCurrentSnapshot_Task) soap.HasFault
func (*VirtualMachine) ShutdownGuest ¶
func (vm *VirtualMachine) ShutdownGuest(ctx *Context, c *types.ShutdownGuest) soap.HasFault
func (*VirtualMachine) SuspendVMTask ¶ added in v0.19.0
func (vm *VirtualMachine) SuspendVMTask(ctx *Context, req *types.SuspendVM_Task) soap.HasFault
func (*VirtualMachine) UnregisterVM ¶
func (vm *VirtualMachine) UnregisterVM(ctx *Context, c *types.UnregisterVM) soap.HasFault
type VirtualMachineSnapshot ¶
type VirtualMachineSnapshot struct {
mo.VirtualMachineSnapshot
}
func (*VirtualMachineSnapshot) RemoveSnapshotTask ¶
func (v *VirtualMachineSnapshot) RemoveSnapshotTask(req *types.RemoveSnapshot_Task) soap.HasFault
func (*VirtualMachineSnapshot) RevertToSnapshotTask ¶
func (v *VirtualMachineSnapshot) RevertToSnapshotTask(req *types.RevertToSnapshot_Task) soap.HasFault
Source Files ¶
- authorization_manager.go
- cluster_compute_resource.go
- custom_fields_manager.go
- datacenter.go
- datastore.go
- doc.go
- dvs.go
- entity.go
- event_manager.go
- file_manager.go
- folder.go
- guest_id.go
- host_datastore_browser.go
- host_datastore_system.go
- host_firewall_system.go
- host_local_account_manager.go
- host_network_system.go
- host_system.go
- ip_pool_manager.go
- license_manager.go
- model.go
- option_manager.go
- os_unix.go
- performance_manager.go
- portgroup.go
- property_collector.go
- property_filter.go
- registry.go
- resource_pool.go
- search_index.go
- service_instance.go
- session_manager.go
- simulator.go
- snapshot.go
- task.go
- task_manager.go
- user_directory.go
- view_manager.go
- virtual_disk_manager.go
- virtual_machine.go
Directories ¶
Path | Synopsis |
---|---|
Package esx contains SOAP responses from an ESX server, captured using `govc ...
|
Package esx contains SOAP responses from an ESX server, captured using `govc ... |
Package vpx contains SOAP responses from a vCenter server, captured using `govc ...
|
Package vpx contains SOAP responses from a vCenter server, captured using `govc ... |