computeresource

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2019 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BaseProperties

func BaseProperties(obj BaseComputeResource) (*mo.ComputeResource, error)

BaseProperties returns the base-level ComputeResource managed object for a BaseComputeResource, an interface that any base-level ComputeResource and derivative object implements.

Note that this does not return any cluster-level attributes.

func BasePropertiesFromReference

func BasePropertiesFromReference(client *govmomi.Client, ref types.ManagedObjectReference) (*mo.ComputeResource, error)

BasePropertiesFromReference combines BaseFromReference and BaseProperties to get a base-level ComputeResource managed object for a specific managed object reference.

func ClusterFromID

func ClusterFromID(client *govmomi.Client, id string) (*object.ClusterComputeResource, error)

ClusterFromID returns a ClusterComputeResource, a subclass of ComputeResource that is used for clusters.

func DefaultDevicesFromReference

func DefaultDevicesFromReference(client *govmomi.Client, ref types.ManagedObjectReference, guest string) (object.VirtualDeviceList, error)

DefaultDevicesFromReference fetches the default virtual device list for a specific compute resource from a supplied managed object reference.

func EnvironmentBrowserFromReference added in v1.3.3

func EnvironmentBrowserFromReference(client *govmomi.Client, ref types.ManagedObjectReference) (*envbrowse.EnvironmentBrowser, error)

EnvironmentBrowserFromReference loads an environment browser for the specific compute resource reference. The reference can be either a standalone host or cluster.

As an added safety feature if the compute resource properties come back with an unset environmentBrowser attribute, this function will return an error. This is to protect against cases where this may come up such as licensing issues or clusters without hosts.

func HasChildren added in v1.5.0

func HasChildren(obj BaseComputeResource) (bool, error)

HasChildren checks to see if a compute resource has any child items (hosts and virtual machines) and returns true if that is the case. This is useful when checking to see if a compute cluster is safe to delete - destroying a compute resource in vSphere destroys *all* children if at all possible (including removing hosts and virtual machines), so extra verification is necessary to prevent accidental removal.

func OSFamily

func OSFamily(client *govmomi.Client, ref types.ManagedObjectReference, guest string) (string, error)

OSFamily uses the compute resource's environment browser to get the OS family for a specific guest ID.

func Reconfigure added in v1.5.0

Reconfigure reconfigures any BaseComputeResource that uses a BaseComputeResourceConfigSpec as configuration (example: standalone hosts, or clusters). Modify is always set.

func StandaloneFromID

func StandaloneFromID(client *govmomi.Client, id string) (*object.ComputeResource, error)

StandaloneFromID locates a ComputeResource by its managed object reference ID.

Note this is for base level ComputeResource objects only, and should only be used for standalone hosts. If you are looking for a cluster, use ClusterFromID.

Types

type BaseComputeResource

type BaseComputeResource interface {
	Datastores(context.Context) ([]*object.Datastore, error)
	Destroy(context.Context) (*object.Task, error)
	Hosts(context.Context) ([]*object.HostSystem, error)
	Reconfigure(context.Context, types.BaseComputeResourceConfigSpec, bool) (*object.Task, error)
	ResourcePool(context.Context) (*object.ResourcePool, error)

	Name() string
	Properties(context.Context, types.ManagedObjectReference, []string, interface{}) error
	Reference() types.ManagedObjectReference
	String() string
}

BaseComputeResource is an interface that ComputeResource and any derivative types will implement on part of having all of the methods available to ComputeResource. It also contains the Properties method from the common-level object method set.

Its use is mainly to facilitate common functionality between the two in helpers.

func BaseFromPath

func BaseFromPath(client *govmomi.Client, path string) (BaseComputeResource, error)

BaseFromPath returns a BaseComputeResource for a given path.

func BaseFromReference

func BaseFromReference(client *govmomi.Client, ref types.ManagedObjectReference) (BaseComputeResource, error)

BaseFromReference returns a BaseComputeResource for a given managed object reference.

Jump to

Keyboard shortcuts

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