esxi

package
v0.0.0-...-a2e11bd Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2023 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseFile

func CloseFile(file *os.File)

func Contains

func Contains[T comparable](collection []T, value T) bool

Contains checks if an item is present in a collection

func ContainsValue

func ContainsValue[V comparable, T any](collection []T, selector func(T) V, value V) bool

ContainsValue checks if an item property value is present in a collection

func EncodeVMX

func EncodeVMX(contents map[string]string) string

EncodeVMX takes a map and turns it into valid VMX contents.

func ParseTemplate

func ParseTemplate(text string, data any) (string, error)

func ParseVMX

func ParseVMX(contents string) map[string]string

ParseVMX parses the keys and values from a VMX file and returns them as a Go map.

func PortGroupCreate

func PortGroupCreate(inputs resource.PropertyMap, esxi *Host) (string, resource.PropertyMap, error)

func PortGroupDelete

func PortGroupDelete(id string, esxi *Host) error

func PortGroupRead

func PortGroupRead(id string, inputs resource.PropertyMap, esxi *Host) (string, resource.PropertyMap, error)

func PortGroupUpdate

func PortGroupUpdate(id string, inputs resource.PropertyMap, esxi *Host) (string, resource.PropertyMap, error)

func RemoveFile

func RemoveFile(file *os.File)

func ResourcePoolCreate

func ResourcePoolCreate(inputs resource.PropertyMap, esxi *Host) (string, resource.PropertyMap, error)

func ResourcePoolDelete

func ResourcePoolDelete(id string, esxi *Host) error

func ResourcePoolRead

func ResourcePoolRead(id string, inputs resource.PropertyMap, esxi *Host) (string, resource.PropertyMap, error)

func ResourcePoolUpdate

func ResourcePoolUpdate(id string, inputs resource.PropertyMap, esxi *Host) (string, resource.PropertyMap, error)

func VirtualDiskCreate

func VirtualDiskCreate(inputs resource.PropertyMap, esxi *Host) (string, resource.PropertyMap, error)

func VirtualDiskDelete

func VirtualDiskDelete(id string, esxi *Host) error

func VirtualDiskRead

func VirtualDiskRead(id string, _ resource.PropertyMap, esxi *Host) (string, resource.PropertyMap, error)

func VirtualDiskUpdate

func VirtualDiskUpdate(id string, inputs resource.PropertyMap, esxi *Host) (string, resource.PropertyMap, error)

func VirtualMachineCreate

func VirtualMachineCreate(inputs resource.PropertyMap, esxi *Host) (string, resource.PropertyMap, error)

func VirtualMachineDelete

func VirtualMachineDelete(id string, esxi *Host) error

func VirtualMachineGet

func VirtualMachineGet(inputs resource.PropertyMap, esxi *Host) (resource.PropertyMap, error)

func VirtualMachineRead

func VirtualMachineRead(id string, _ resource.PropertyMap, esxi *Host) (string, resource.PropertyMap, error)

func VirtualMachineUpdate

func VirtualMachineUpdate(id string, inputs resource.PropertyMap, esxi *Host) (string, resource.PropertyMap, error)

func VirtualSwitchCreate

func VirtualSwitchCreate(inputs resource.PropertyMap, esxi *Host) (string, resource.PropertyMap, error)

func VirtualSwitchDelete

func VirtualSwitchDelete(id string, esxi *Host) error

func VirtualSwitchRead

func VirtualSwitchRead(id string, _ resource.PropertyMap, esxi *Host) (string, resource.PropertyMap, error)

func VirtualSwitchUpdate

func VirtualSwitchUpdate(id string, inputs resource.PropertyMap, esxi *Host) (string, resource.PropertyMap, error)

func WriteVMX

func WriteVMX(path string, data map[string]string) error

WriteVMX takes a path to a VMX file and contents in the form of a map and writes it out.

Types

type AutoNamingService

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

func NewAutoNamingService

func NewAutoNamingService() *AutoNamingService

func (*AutoNamingService) GetAutoNamingSpec

func (service *AutoNamingService) GetAutoNamingSpec(token string) *AutoNamingSpec

type AutoNamingSpec

type AutoNamingSpec struct {
	PropertyName string
	MinLength    int
	MaxLength    int
}

type ConnectionInfo

type ConnectionInfo struct {
	Host     string
	SSHPort  string
	SslPort  string
	UserName string
	Password string
}

type Host

type Host struct {
	ClientConfig *ssh.ClientConfig
	Connection   *ConnectionInfo
}

func NewHost

func NewHost(host, sshPort, sslPort, user, pass string) (*Host, error)

func (*Host) CopyFile

func (esxi *Host) CopyFile(localPath string, hostPath string, shortCmdDesc string) (string, error)

func (*Host) Execute

func (esxi *Host) Execute(command string, shortCmdDesc string) (string, error)

func (*Host) WriteFile

func (esxi *Host) WriteFile(content string, path string, shortCmdDesc string) (string, error)

type KeyValuePair

type KeyValuePair struct {
	Key   string
	Value string
}

type NetworkInterface

type NetworkInterface struct {
	MacAddress     string
	NicType        string
	VirtualNetwork string
}

type PortGroup

type PortGroup struct {
	// Forged transmits (true=Accept/false=Reject).
	ForgedTransmits string
	// Id
	Id string
	// MAC address changes (true=Accept/false=Reject).
	MacChanges string
	// Port Group Virtual Switch.
	VSwitch string
	// Port Group Virtual LAN.
	Vlan int
	// Virtual Switch name.
	Name string
	// Promiscuous mode (true=Accept/false=Reject).
	PromiscuousMode string
}

type PortGroupSecurityPolicy

type PortGroupSecurityPolicy struct {
	AllowForgedTransmits  bool `csv:"AllowForgedTransmits"`
	AllowMACAddressChange bool `csv:"AllowMACAddressChange"`
	AllowPromiscuous      bool `csv:"AllowPromiscuous"`
}

type ResourcePool

type ResourcePool struct {
	// CPU maximum (in MHz).
	CpuMax int
	// CPU minimum (in MHz).
	CpuMin int
	// Can pool borrow CPU resources from parent?
	CpuMinExpandable string
	// CPU shares (low/normal/high/<custom>).
	CpuShares string
	// Id
	Id string
	// Memory maximum (in MB).
	MemMax int
	// Memory minimum (in MB).
	MemMin int
	// Can pool borrow memory resources from parent?
	MemMinExpandable string
	// Memory shares (low/normal/high/<custom>).
	MemShares string
	// Resource Pool Name
	Name string
}

type ResourceService

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

func NewResourceService

func NewResourceService() *ResourceService

func (*ResourceService) Create

func (receiver *ResourceService) Create(token string, inputs resource.PropertyMap, esxi *Host) (string, resource.PropertyMap, error)

func (*ResourceService) Delete

func (receiver *ResourceService) Delete(token string, id string, esxi *Host) error

func (*ResourceService) Invoke

func (receiver *ResourceService) Invoke(token string, inputs resource.PropertyMap, esxi *Host) (resource.PropertyMap, error)

func (*ResourceService) Read

func (receiver *ResourceService) Read(token string, id string, inputs resource.PropertyMap, esxi *Host) (string, resource.PropertyMap, error)

func (*ResourceService) Update

func (receiver *ResourceService) Update(token string, id string, inputs resource.PropertyMap, esxi *Host) (resource.PropertyMap, error)

func (*ResourceService) Validate

func (receiver *ResourceService) Validate(token string, inputs resource.PropertyMap) ([]*pulumirpc.CheckFailure, error)
type Uplink struct {
	// Uplink name.
	Name string
}

type VMVirtualDisk

type VMVirtualDisk struct {
	// SCSI_Ctrl:SCSI_id.    Range  '0:1' to '0:15'.   SCSI_id 7 is not allowed.
	Slot          string
	VirtualDiskId string
}

type VirtualDisk

type VirtualDisk struct {
	// Disk directory.
	Directory string
	// Disk Store.
	DiskStore string
	// Virtual Disk type.
	DiskType string
	// Id
	Id string
	// Virtual Disk Name.
	Name string
	// Virtual Disk size in GB.
	Size int
}

type VirtualMachine

type VirtualMachine struct {
	// VM boot disk size. Will expand boot disk to this size.
	BootDiskSize int
	// VM boot disk type.
	BootDiskType string
	// Boot type('efi' is boot uefi mode)
	BootFirmware string
	// esxi DiskStore for boot disk.
	DiskStore string
	// pass data to VM
	Id string
	// pass data to VM
	Info []KeyValuePair
	// The IP address reported by VMWare tools.
	IpAddress string
	// VM memory size.
	MemSize int
	// esxi vm name.
	Name string
	// VM network interfaces.
	NetworkInterfaces []NetworkInterface
	// VM memory size.
	Notes string
	// VM number of virtual cpus.
	NumVCpus int
	// VM OS type.
	Os string
	// VM OVF properties.
	OvfProperties []KeyValuePair
	// The amount of time, in seconds, to wait for the guest to boot and run ovfProperties. (0-6000)
	OvfPropertiesTimer int
	// VM power state.
	Power string
	// Resource pool name to place vm.
	ResourcePoolName string
	// The amount of vm uptime, in seconds, to wait for an available IP address on this virtual machine.
	ShutdownTimeout int
	// Local path to source.
	SourcePath string
	// The amount of vm uptime, in seconds, to wait for an available IP address on this virtual machine.
	StartupTimeout int
	// VM virtual disks.
	VirtualDisks []VMVirtualDisk
	// VM Virtual HW version.
	VirtualHWVer int
}

type VirtualSwitch

type VirtualSwitch struct {
	// Forged transmits (true=Accept/false=Reject).
	ForgedTransmits bool
	// Id
	Id string
	// Virtual Switch Link Discovery Mode.
	LinkDiscoveryMode string
	// MAC address changes (true=Accept/false=Reject).
	MacChanges bool
	// Virtual Switch mtu. (1280-9000)
	Mtu int
	// Virtual Switch name.
	Name string
	// Virtual Switch number of ports. (1-4096)
	Ports int
	// Promiscuous mode (true=Accept/false=Reject).
	PromiscuousMode bool
	// Uplink configuration.
	Uplinks []Uplink
}

Jump to

Keyboard shortcuts

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