Back to godoc.org
github.com/genevievelesperance/leftovers/vsphere

package vsphere

v0.55.0
Latest Go to latest
Published: Aug 4, 2019 | License: Apache-2.0 | Module: github.com/genevievelesperance/leftovers

Index

func DatacenterFromID

func DatacenterFromID(client *govmomi.Client, id string) (*object.Datacenter, error)

type Client

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

func NewClient

func NewClient(vmomi *govmomi.Client, datacenter string) Client

func (Client) GetRootFolder

func (c Client) GetRootFolder(filter string) (*object.Folder, error)

type Folder

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

Folder represents an inventory folder within vSphere.

func NewFolder

func NewFolder(folder *object.Folder, name string) Folder

func (Folder) Delete

func (f Folder) Delete() error

func (Folder) Name

func (f Folder) Name() string

func (Folder) Type

func (f Folder) Type() string

type Folders

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

func NewFolders

func NewFolders(client client, logger logger) Folders

func (Folders) List

func (v Folders) List(filter string, rType string) ([]common.Deletable, error)

List not only lists top-level folders, it also lists child and grandchild folders, and all VMs within those folders.

func (Folders) Type

func (f Folders) Type() string

type Leftovers

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

func NewLeftovers

func NewLeftovers(logger logger, vCenterIP, vCenterUser, vCenterPassword, vCenterDC string) (Leftovers, error)

NewLeftovers returns a new Leftovers for vSphere that can be used to list resources, list types, or delete resources for the provided account. It returns an error if the credentials provided are invalid or a client cannot be created.

func (Leftovers) Delete

func (l Leftovers) Delete(filter string) error

Delete will collect all resources that contain the provided filter in the resource's identifier, prompt you to confirm deletion (if enabled), and delete those that are selected.

func (Leftovers) DeleteByType

func (l Leftovers) DeleteByType(filter, rType string) error

DeleteByType will collect all resources of the provied type that contain the provided filter in the resource's identifier, prompt you to confirm deletion, and delete those that are selected.

func (Leftovers) List

func (l Leftovers) List(filter string)

List will print all the resources that contain the provided filter in the resource's identifier.

func (Leftovers) ListByType

func (l Leftovers) ListByType(filter, rType string)

ListByType defaults to List.

func (Leftovers) Types

func (l Leftovers) Types()

Types will print all the resource types that can be deleted on this IaaS.

type VirtualMachine

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

VirtualMachine represents a vm or template in vSphere.

func NewVirtualMachine

func NewVirtualMachine(vm *object.VirtualMachine) VirtualMachine

func (VirtualMachine) Delete

func (v VirtualMachine) Delete() error

Delete will shut off a VM, if it is powered on or suspended, and will delete a VM or template from inventory.

func (VirtualMachine) Name

func (v VirtualMachine) Name() string

func (VirtualMachine) Type

func (v VirtualMachine) Type() string
Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
f or F : Jump to identifier