vc

package
v0.0.0-...-f1610be Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2022 License: Apache-2.0 Imports: 17 Imported by: 3

Documentation

Index

Constants

View Source
const (
	EnvURL      = "VC_URL"
	EnvUserName = "VC_USERNAME"
	EnvPassword = "VC_PASSWORD"
	EnvInsecure = "VC_INSECURE"
)

Variables

This section is empty.

Functions

func Connect

func Connect(ctx context.Context, hostname string, username string, password string) (*govmomi.Client, error)

Connect Function open connection to vCenter or ESXi.

func ExtractUrl

func ExtractUrl(hostname string) (*url.URL, error)

ExtractUrl naive url extractor

func Find

func Find(obj interface{}, key string) (interface{}, bool)

Find key in interface and return value as interface

func StringOrEnv

func StringOrEnv(str string, envName string) (string, error)

StringOrEnv check if string not empty return , or get from env, otherwise error

Types

type Runner

type Runner interface {
	Run(ctx context.Context, c *vim25.Client, args map[string]interface{}) error
}

type VSphereRest

type VSphereRest struct {
	Ctl *vim25.Client
	// contains filtered or unexported fields
}

VSphereRest main rest api struct

func (*VSphereRest) GetDatastores

func (rest *VSphereRest) GetDatastores(ctx context.Context, path string) (*VsphereDatastores, error)

GetDatastores upload a file to target datastore.

func (*VSphereRest) Upload

func (rest *VSphereRest) Upload(ctx context.Context, datastoreName string, src string, dst string) error

Upload upload a file to target datastore.

type VsphereDatastore

type VsphereDatastore struct {
	DatacenterPath string                                   `json:"DatacenterPath" yaml:"DatacenterPath"`
	InventoryPath  string                                   `json:"InventoryPath" yaml:"InventoryPath"`
	Name           string                                   `json:"Name" yaml:"Name"`
	Hosts          map[string]VsphereHost                   `json:"Hosts" yaml:"Hosts"`
	Type           types.HostFileSystemVolumeFileSystemType `json:"Type" yaml:"Type"`
}

VsphereDatastore vsphere datastore Example /Datacenter is path

type VsphereDatastores

type VsphereDatastores struct {
	Datastores map[string]VsphereDatastore
}

type VsphereHost

type VsphereHost struct {
	Reference     string               `json:"Reference" yaml:"Reference"`
	ManagementIPs []net.IP             `json:"ManagementAddress" yaml:"ManagementAddress"`
	Disks         []types.HostScsiDisk `json:"Disks" yaml:"Disks"`
}

VsphereHost A datastore host

Jump to

Keyboard shortcuts

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