importer

package
v0.0.0-...-5f55900 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsRemotePath

func IsRemotePath(path string) bool

func OVFMap

func OVFMap(op []Property) (p []types.KeyValue)

func ReadEnvelope

func ReadEnvelope(data []byte) (*ovf.Envelope, error)

func ReadOvf

func ReadOvf(fpath string, a Archive) ([]byte, error)

func ValidateChecksum

func ValidateChecksum(ctx context.Context, lease *nfc.Lease, sum *library.Checksum, file string, key string) error

func ValidateNetwork

func ValidateNetwork(e *ovf.Envelope, net Network) error

Types

type Archive

type Archive interface {
	Open(string) (io.ReadCloser, int64, error)
}

type FileArchive

type FileArchive struct {
	Path string
	Opener
}

func (*FileArchive) Open

func (t *FileArchive) Open(name string) (io.ReadCloser, int64, error)

type Importer

type Importer struct {
	Log progress.LogFunc

	Name           string
	VerifyManifest bool
	Hidden         bool

	Client *vim25.Client
	Finder *find.Finder
	Sinker progress.Sinker

	Datacenter   *object.Datacenter
	Datastore    *object.Datastore
	ResourcePool *object.ResourcePool
	Host         *object.HostSystem
	Folder       *object.Folder

	Archive  Archive
	Manifest map[string]*library.Checksum
}

func (*Importer) Import

func (imp *Importer) Import(ctx context.Context, fpath string, opts Options) (*types.ManagedObjectReference, error)

func (*Importer) NetworkMap

func (imp *Importer) NetworkMap(ctx context.Context, e *ovf.Envelope, networks []Network) ([]types.OvfNetworkMapping, error)

func (*Importer) ReadManifest

func (imp *Importer) ReadManifest(fpath string) error

func (*Importer) Upload

func (imp *Importer) Upload(ctx context.Context, lease *nfc.Lease, item nfc.FileItem) error

type KeyValue

type KeyValue struct {
	Key   string
	Value string
}

func (*KeyValue) UnmarshalJSON

func (kv *KeyValue) UnmarshalJSON(b []byte) error

case insensitive for Key + Value

type Network

type Network struct {
	Name    string
	Network string
}

type Opener

type Opener struct {
	*vim25.Client
}

func (Opener) OpenFile

func (o Opener) OpenFile(path string) (io.ReadCloser, int64, error)

func (Opener) OpenLocal

func (o Opener) OpenLocal(path string) (io.ReadCloser, int64, error)

func (Opener) OpenRemote

func (o Opener) OpenRemote(link string) (io.ReadCloser, int64, error)

type Options

type Options struct {
	AllDeploymentOptions []string `json:",omitempty"`
	Deployment           string   `json:",omitempty"`

	AllDiskProvisioningOptions []string `json:",omitempty"`
	DiskProvisioning           string

	AllIPAllocationPolicyOptions []string `json:",omitempty"`
	IPAllocationPolicy           string

	AllIPProtocolOptions []string `json:",omitempty"`
	IPProtocol           string

	PropertyMapping []Property `json:",omitempty"`

	NetworkMapping []Network `json:",omitempty"`

	Annotation string `json:",omitempty"`

	MarkAsTemplate bool
	PowerOn        bool
	InjectOvfEnv   bool
	WaitForIP      bool
	Name           *string
}

func Spec

func Spec(fpath string, a Archive, hidden, verbose bool) (*Options, error)

type Property

type Property struct {
	KeyValue
	Spec *ovf.Property `json:",omitempty"`
}

func SpecMap

func SpecMap(e *ovf.Envelope, hidden, verbose bool) (res []Property)

type TapeArchive

type TapeArchive struct {
	Path string
	Opener
}

func (*TapeArchive) Open

func (t *TapeArchive) Open(name string) (io.ReadCloser, int64, error)

type TapeArchiveEntry

type TapeArchiveEntry struct {
	io.Reader

	Name string
	// contains filtered or unexported fields
}

func (*TapeArchiveEntry) Close

func (t *TapeArchiveEntry) Close() error

Jump to

Keyboard shortcuts

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