vsphere

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DeployInfo

type DeployInfo struct {
	TemplateName  string
	VMObject      *object.VirtualMachine
	AlreadyExists bool
}

DeployInfo is data for a deployed OVA

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) DeployOVATemplate

func (s *Session) DeployOVATemplate(templatePath string) (DeployInfo, error)

DeployOVATemplate uploads ova and makes it a template

func (*Session) DeployOVATemplates

func (s *Session) DeployOVATemplates(templatePaths ...string) (map[string]DeployInfo, error)

DeployOVATemplates deploys multiple OVAs asynchronously

func (*Session) GetDatacenterOrDefault

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

GetDatacenterOrDefault returns the govmomi object for a datacenter

func (*Session) GetDatastoreOrDefault

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

GetDatastoreOrDefault returns the govmomi object for a datastore

func (*Session) GetFolderOrDefault

func (s *Session) GetFolderOrDefault(name string) (*object.Folder, error)

GetFolderOrDefault returns a single folder object

func (*Session) GetNetworkOrDefault

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

GetNetworkOrDefault returns the govmomi object for a network

func (*Session) GetResourcePoolOrDefault

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

GetResourcePoolOrDefault 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