vsphere

package
v0.0.0-...-3d086f3 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: AGPL-3.0 Imports: 47 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Bootstrap = common.Bootstrap

Bootstrap is exported, because it has to be rewritten in external unit tests

View Source
var DestroyEnv = common.Destroy

DestroyEnv is exported, because it has to be rewritten in external unit tests.

View Source
var FinishInstanceConfig = instancecfg.FinishInstanceConfig

FinishInstanceConfig is exported, because it has to be rewritten in external unit tests

Functions

func HandleCredentialError

func HandleCredentialError(err error, env *sessionEnviron, ctx context.ProviderCallContext)

HandleCredentialError marks the current credential as invalid if the passed vsphere error indicates it should be.

func IsAuthorisationFailure

func IsAuthorisationFailure(err error) bool

IsAuthorisationFailure determines whether the given error indicates that the vsphere credential used is bad.

func NewEnvironProvider

func NewEnvironProvider(config EnvironProviderConfig) environs.CloudEnvironProvider

NewEnvironProvider returns a new environs.EnvironProvider that will dial vSphere connections with the given dial function.

Types

type Client

type Client interface {
	Close(context.Context) error
	ComputeResources(context.Context) ([]vsphereclient.ComputeResource, error)
	CreateVirtualMachine(context.Context, vsphereclient.CreateVirtualMachineParams) (*mo.VirtualMachine, error)
	CreateTemplateVM(ctx context.Context, ovaArgs vsphereclient.ImportOVAParameters) (vm *object.VirtualMachine, err error)
	Folders(ctx context.Context) (*object.DatacenterFolders, error)
	Datastores(context.Context) ([]mo.Datastore, error)
	DeleteDatastoreFile(context.Context, string) error
	DestroyVMFolder(context.Context, string) error
	EnsureVMFolder(context.Context, string, string) (*object.Folder, error)
	GetTargetDatastore(ctx context.Context, computeResource *mo.ComputeResource, rootDiskSource string) (*object.Datastore, error)
	ListVMTemplates(ctx context.Context, path string) ([]*object.VirtualMachine, error)
	MoveVMFolderInto(context.Context, string, string) error
	MoveVMsInto(context.Context, string, ...types.ManagedObjectReference) error
	RemoveVirtualMachines(context.Context, string) error
	ResourcePools(context.Context, string) ([]*object.ResourcePool, error)
	UpdateVirtualMachineExtraConfig(context.Context, *mo.VirtualMachine, map[string]string) error
	VirtualMachines(context.Context, string) ([]*mo.VirtualMachine, error)
	VirtualMachineObjectToManagedObject(ctx context.Context, vmObject *object.VirtualMachine) (mo.VirtualMachine, error)
	UserHasRootLevelPrivilege(context.Context, string) (bool, error)
	FindFolder(ctx context.Context, folderPath string) (vmFolder *object.Folder, err error)
}

Client is an interface for interacting with the vSphere API.

type DialFunc

type DialFunc func(_ context.Context, _ *url.URL, datacenter string) (Client, error)

DialFunc is a function type for dialing vSphere client connections.

type EnvironProviderConfig

type EnvironProviderConfig struct {
	// Dial is a function used for dialing connections to vCenter/ESXi.
	Dial DialFunc
}

EnvironProviderConfig contains configuration for the EnvironProvider.

type OvaFileMetadata

type OvaFileMetadata struct {
	URL      string
	Arch     string `json:"arch"`
	Size     int    `json:"size"`
	Path     string `json:"path"`
	FileType string `json:"ftype"`
	Sha256   string `json:"sha256"`
	Md5      string `json:"md5"`
}

type VsphereRenderer

type VsphereRenderer struct{}

func (VsphereRenderer) Render

Directories

Path Synopsis
internal
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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