vsphere

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadCredentials

func LoadCredentials(path string) (string, string, string, error)

func LoadLocations

func LoadLocations(path string) (map[string]*Location, error)

Types

type Client

type Client struct {
	Locations map[string]*Location
	// contains filtered or unexported fields
}

Client wraps the govmomi client

func New

func New(c Config, ctx context.Context) (*Client, error)

New initializes a new vSphere client

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, name string, loc string) error

Delete deletes an image from vSphere

func (*Client) Exists

func (c *Client) Exists(ctx context.Context, name string, loc string) (bool, error)

Exists checks if an image already exists in vSphere

func (*Client) GetVMPath

func (c *Client) GetVMPath(name string, loc string) string

func (*Client) Import

func (c *Client) Import(ctx context.Context, imageURL string, imageName string, loc string) (
	*types.ManagedObjectReference, error)

Import imports an OVF image to vSphere

func (*Client) Process

func (c *Client) Process(ctx context.Context, ref types.ManagedObjectReference) error

Process processes the OVF image

type Config

type Config struct {
	CredentialsFile string
	LocationsFile   string
}

Config holds the configuration for the vSphere client

type ImporterConfig

type ImporterConfig struct {
	Name         string
	Datacenter   *object.Datacenter
	Datastore    *object.Datastore
	Folder       *object.Folder
	Host         *object.HostSystem
	Network      types.ManagedObjectReference
	ResourcePool *object.ResourcePool
	Finder       *find.Finder
	Path         string
}

ImporterConfig holds the configuration for the OVF importer

type Location

type Location struct {
	Datacenter   string `yaml:"datacenter"`
	Datastore    string `yaml:"datastore"`
	Folder       string `yaml:"folder"`
	Host         string `yaml:"host"`
	Resourcepool string `yaml:"resourcepool"`
	Network      string `yaml:"network"`
	Cluster      string `yaml:"cluster"`
}

Jump to

Keyboard shortcuts

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