vsphere

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Session

type Session struct {
	Conn         *govmomi.Client
	Datacenter   *object.Datacenter
	Datastore    *object.Datastore
	Folder       *object.Folder
	ResourcePool *object.ResourcePool
	Network      object.NetworkReference
	Ctx          context.Context
}

Session contains vsphere connection and object data

func NewClient

func NewClient(ctx context.Context, server string, username string, password string) (*Session, error)

NewClient returns a new vsphere Session

func (*Session) DatastoreCapacity

func (s *Session) DatastoreCapacity() (capacity, free float64, err error)

DatastoreCapacity gets the datastore capacity and free space in KB from vcenter and returns it in GB referenced from https://github.com/vmware/govmomi/blob/master/govc/datastore/info.go

func (*Session) GetDatacenter

func (s *Session) GetDatacenter(name string) (*object.Datacenter, error)

GetDatacenter returns the govmomi object for a datacenter

func (*Session) GetDatastore

func (s *Session) GetDatastore(name string) (*object.Datastore, error)

GetDatastore returns the govmomi object for a datastore

func (*Session) GetNetwork

func (s *Session) GetNetwork(name string) (object.NetworkReference, error)

GetNetwork returns the govmomi object for a network

func (*Session) GetResourcePool

func (s *Session) GetResourcePool(name string) (*object.ResourcePool, error)

GetResourcePool returns the govmomi object for a resource pool

func (*Session) GetVM

func (s *Session) GetVM(name string) (*object.VirtualMachine, error)

GetVM returns the govmomi object for a virtual machine

func (*Session) GetVMTotalStorageSize

func (s *Session) GetVMTotalStorageSize(vmName string) (size float64, err error)

GetVMTotalStorageSize returns the total VM storage size (in GB) of all attached disks to a VM

Jump to

Keyboard shortcuts

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