ovf

package
v0.46.2 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: Apache-2.0 Imports: 13 Imported by: 103

Documentation

Overview

Package ovf provides functionality to unmarshal and inspect the structure of an OVF file. It is not a complete implementation of the specification and is intended to be used to import virtual infrastructure into vSphere.

For a complete specification of the OVF standard, refer to: https://www.dmtf.org/sites/default/files/standards/documents/DSP0243_2.1.0.pdf

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseCapacityAllocationUnits added in v0.40.0

func ParseCapacityAllocationUnits(s string) int64

ParseCapacityAllocationUnits validates the string s is a valid programmatic unit with respect to the base unit 'byte' and parses the string to return the number of bytes s represents

Types

type AnnotationSection

type AnnotationSection struct {
	Section

	Annotation string `xml:"Annotation"`
}

type CIMResourceAllocationSettingData

type CIMResourceAllocationSettingData struct {
	ElementName string `xml:"ElementName"`
	InstanceID  string `xml:"InstanceID"`

	ResourceType      *uint16 `xml:"ResourceType"`
	OtherResourceType *string `xml:"OtherResourceType"`
	ResourceSubType   *string `xml:"ResourceSubType"`

	AddressOnParent       *string  `xml:"AddressOnParent"`
	Address               *string  `xml:"Address"`
	AllocationUnits       *string  `xml:"AllocationUnits"`
	AutomaticAllocation   *bool    `xml:"AutomaticAllocation"`
	AutomaticDeallocation *bool    `xml:"AutomaticDeallocation"`
	Caption               *string  `xml:"Caption"`
	Connection            []string `xml:"Connection"`
	ConsumerVisibility    *uint16  `xml:"ConsumerVisibility"`
	Description           *string  `xml:"Description"`
	HostResource          []string `xml:"HostResource"`
	Limit                 *uint64  `xml:"Limit"`
	MappingBehavior       *uint    `xml:"MappingBehavior"`
	Parent                *string  `xml:"Parent"`
	PoolID                *string  `xml:"PoolID"`
	Reservation           *uint64  `xml:"Reservation"`
	VirtualQuantity       *uint    `xml:"VirtualQuantity"`
	VirtualQuantityUnits  *string  `xml:"VirtualQuantityUnits"`
	Weight                *uint    `xml:"Weight"`
}

type CIMStorageAllocationSettingData added in v0.22.0

type CIMStorageAllocationSettingData struct {
	ElementName string `xml:"ElementName"`
	InstanceID  string `xml:"InstanceID"`

	ResourceType      *uint16 `xml:"ResourceType"`
	OtherResourceType *string `xml:"OtherResourceType"`
	ResourceSubType   *string `xml:"ResourceSubType"`

	Access                       *uint16         `xml:"Access"`
	Address                      *string         `xml:"Address"`
	AddressOnParent              *string         `xml:"AddressOnParent"`
	AllocationUnits              *string         `xml:"AllocationUnits"`
	AutomaticAllocation          *bool           `xml:"AutomaticAllocation"`
	AutomaticDeallocation        *bool           `xml:"AutomaticDeallocation"`
	Caption                      *string         `xml:"Caption"`
	ChangeableType               *uint16         `xml:"ChangeableType"`
	ComponentSetting             []types.AnyType `xml:"ComponentSetting"`
	ConfigurationName            *string         `xml:"ConfigurationName"`
	Connection                   []string        `xml:"Connection"`
	ConsumerVisibility           *uint16         `xml:"ConsumerVisibility"`
	Description                  *string         `xml:"Description"`
	Generation                   *uint64         `xml:"Generation"`
	HostExtentName               *string         `xml:"HostExtentName"`
	HostExtentNameFormat         *uint16         `xml:"HostExtentNameFormat"`
	HostExtentNameNamespace      *uint16         `xml:"HostExtentNameNamespace"`
	HostExtentStartingAddress    *uint64         `xml:"HostExtentStartingAddress"`
	HostResource                 []string        `xml:"HostResource"`
	HostResourceBlockSize        *uint64         `xml:"HostResourceBlockSize"`
	Limit                        *uint64         `xml:"Limit"`
	MappingBehavior              *uint           `xml:"MappingBehavior"`
	OtherHostExtentNameFormat    *string         `xml:"OtherHostExtentNameFormat"`
	OtherHostExtentNameNamespace *string         `xml:"OtherHostExtentNameNamespace"`
	Parent                       *string         `xml:"Parent"`
	PoolID                       *string         `xml:"PoolID"`
	Reservation                  *uint64         `xml:"Reservation"`
	SoID                         *string         `xml:"SoID"`
	SoOrgID                      *string         `xml:"SoOrgID"`
	VirtualQuantity              *uint           `xml:"VirtualQuantity"`
	VirtualQuantityUnits         *string         `xml:"VirtualQuantityUnits"`
	VirtualResourceBlockSize     *uint64         `xml:"VirtualResourceBlockSize"`
	Weight                       *uint           `xml:"Weight"`
}

Source: http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.24.0/CIM_StorageAllocationSettingData.xsd

type CIMVirtualSystemSettingData

type CIMVirtualSystemSettingData struct {
	ElementName string `xml:"ElementName"`
	InstanceID  string `xml:"InstanceID"`

	AutomaticRecoveryAction              *uint8   `xml:"AutomaticRecoveryAction"`
	AutomaticShutdownAction              *uint8   `xml:"AutomaticShutdownAction"`
	AutomaticStartupAction               *uint8   `xml:"AutomaticStartupAction"`
	AutomaticStartupActionDelay          *string  `xml:"AutomaticStartupActionDelay>Interval"`
	AutomaticStartupActionSequenceNumber *uint16  `xml:"AutomaticStartupActionSequenceNumber"`
	Caption                              *string  `xml:"Caption"`
	ConfigurationDataRoot                *string  `xml:"ConfigurationDataRoot"`
	ConfigurationFile                    *string  `xml:"ConfigurationFile"`
	ConfigurationID                      *string  `xml:"ConfigurationID"`
	CreationTime                         *string  `xml:"CreationTime"`
	Description                          *string  `xml:"Description"`
	LogDataRoot                          *string  `xml:"LogDataRoot"`
	Notes                                []string `xml:"Notes"`
	RecoveryFile                         *string  `xml:"RecoveryFile"`
	SnapshotDataRoot                     *string  `xml:"SnapshotDataRoot"`
	SuspendDataRoot                      *string  `xml:"SuspendDataRoot"`
	SwapFileDataRoot                     *string  `xml:"SwapFileDataRoot"`
	VirtualSystemIdentifier              *string  `xml:"VirtualSystemIdentifier"`
	VirtualSystemType                    *string  `xml:"VirtualSystemType"`
}

type Config added in v0.24.1

type Config struct {
	Required *bool  `xml:"required,attr"`
	Key      string `xml:"key,attr"`
	Value    string `xml:"value,attr"`
}

type Content

type Content struct {
	ID   string  `xml:"id,attr"`
	Info string  `xml:"Info"`
	Name *string `xml:"Name"`
}

type DeploymentOptionConfiguration

type DeploymentOptionConfiguration struct {
	ID      string `xml:"id,attr"`
	Default *bool  `xml:"default,attr"`

	Label       string `xml:"Label"`
	Description string `xml:"Description"`
}

type DeploymentOptionSection

type DeploymentOptionSection struct {
	Section

	Configuration []DeploymentOptionConfiguration `xml:"Configuration"`
}

type DiskSection

type DiskSection struct {
	Section

	Disks []VirtualDiskDesc `xml:"Disk"`
}

type Env

type Env struct {
	XMLName xml.Name `xml:"http://schemas.dmtf.org/ovf/environment/1 Environment"`
	ID      string   `xml:"id,attr"`
	EsxID   string   `xml:"http://www.vmware.com/schema/ovfenv esxId,attr"`

	Platform *PlatformSection `xml:"PlatformSection"`
	Property *PropertySection `xml:"PropertySection"`
}

func (Env) Marshal added in v0.3.0

func (e Env) Marshal() (string, error)

Marshal marshals Env to xml by using xml.Marshal.

func (Env) MarshalManual added in v0.3.0

func (e Env) MarshalManual() string

MarshalManual manually marshals Env to xml suitable for a vApp guest. It exists to overcome the lack of expressiveness in Go's XML namespaces.

type EnvProperty

type EnvProperty struct {
	Key   string `xml:"key,attr"`
	Value string `xml:"value,attr"`
}

type Envelope

type Envelope struct {
	References []File `xml:"References>File"`

	// Package level meta-data
	Annotation         *AnnotationSection         `xml:"AnnotationSection"`
	Product            *ProductSection            `xml:"ProductSection"`
	Network            *NetworkSection            `xml:"NetworkSection"`
	Disk               *DiskSection               `xml:"DiskSection"`
	OperatingSystem    *OperatingSystemSection    `xml:"OperatingSystemSection"`
	Eula               *EulaSection               `xml:"EulaSection"`
	VirtualHardware    *VirtualHardwareSection    `xml:"VirtualHardwareSection"`
	ResourceAllocation *ResourceAllocationSection `xml:"ResourceAllocationSection"`
	DeploymentOption   *DeploymentOptionSection   `xml:"DeploymentOptionSection"`

	// Content: A VirtualSystem or a VirtualSystemCollection
	VirtualSystem *VirtualSystem `xml:"VirtualSystem"`
}

func Unmarshal

func Unmarshal(r io.Reader) (*Envelope, error)

type EulaSection

type EulaSection struct {
	Section

	License string `xml:"License"`
}

type File

type File struct {
	ID          string  `xml:"id,attr"`
	Href        string  `xml:"href,attr"`
	Size        uint    `xml:"size,attr"`
	Compression *string `xml:"compression,attr"`
	ChunkSize   *int    `xml:"chunkSize,attr"`
}

type Manager added in v0.16.0

type Manager struct {
	types.ManagedObjectReference
	// contains filtered or unexported fields
}

func NewManager added in v0.16.0

func NewManager(c *vim25.Client) *Manager

func (*Manager) CreateDescriptor added in v0.16.0

CreateDescriptor wraps methods.CreateDescriptor

func (*Manager) CreateImportSpec added in v0.16.0

func (m *Manager) CreateImportSpec(ctx context.Context, ovfDescriptor string, resourcePool mo.Reference, datastore mo.Reference, cisp types.OvfCreateImportSpecParams) (*types.OvfCreateImportSpecResult, error)

CreateImportSpec wraps methods.CreateImportSpec

func (*Manager) ParseDescriptor added in v0.16.0

func (m *Manager) ParseDescriptor(ctx context.Context, ovfDescriptor string, pdp types.OvfParseDescriptorParams) (*types.OvfParseDescriptorResult, error)

ParseDescriptor wraps methods.ParseDescriptor

func (*Manager) ValidateHost added in v0.16.0

func (m *Manager) ValidateHost(ctx context.Context, ovfDescriptor string, host mo.Reference, vhp types.OvfValidateHostParams) (*types.OvfValidateHostResult, error)

ValidateHost wraps methods.ValidateHost

type Network

type Network struct {
	Name string `xml:"name,attr"`

	Description string `xml:"Description"`
}

type NetworkSection

type NetworkSection struct {
	Section

	Networks []Network `xml:"Network"`
}

type OperatingSystemSection

type OperatingSystemSection struct {
	Section

	ID      int16   `xml:"id,attr"`
	Version *string `xml:"version,attr"`
	OSType  *string `xml:"osType,attr"`

	Description *string `xml:"Description"`
}

type PlatformSection

type PlatformSection struct {
	Kind    string `xml:"Kind"`
	Version string `xml:"Version"`
	Vendor  string `xml:"Vendor"`
	Locale  string `xml:"Locale"`
}

type ProductSection

type ProductSection struct {
	Section

	Class    *string `xml:"class,attr"`
	Instance *string `xml:"instance,attr"`

	Product     string     `xml:"Product"`
	Vendor      string     `xml:"Vendor"`
	Version     string     `xml:"Version"`
	FullVersion string     `xml:"FullVersion"`
	ProductURL  string     `xml:"ProductUrl"`
	VendorURL   string     `xml:"VendorUrl"`
	AppURL      string     `xml:"AppUrl"`
	Property    []Property `xml:"Property"`
}

func (ProductSection) Key added in v0.33.0

func (p ProductSection) Key(prop Property) string

type Property

type Property struct {
	Key              string  `xml:"key,attr"`
	Type             string  `xml:"type,attr"`
	Qualifiers       *string `xml:"qualifiers,attr"`
	UserConfigurable *bool   `xml:"userConfigurable,attr"`
	Default          *string `xml:"value,attr"`
	Password         *bool   `xml:"password,attr"`

	Label       *string `xml:"Label"`
	Description *string `xml:"Description"`

	Values []PropertyConfigurationValue `xml:"Value"`
}

type PropertyConfigurationValue

type PropertyConfigurationValue struct {
	Value         string  `xml:"value,attr"`
	Configuration *string `xml:"configuration,attr"`
}

type PropertySection

type PropertySection struct {
	Properties []EnvProperty `xml:"Property"`
}

type ResourceAllocationSection

type ResourceAllocationSection struct {
	Section

	Item []ResourceAllocationSettingData `xml:"Item"`
}

type ResourceAllocationSettingData

type ResourceAllocationSettingData struct {
	CIMResourceAllocationSettingData

	Required      *bool   `xml:"required,attr"`
	Configuration *string `xml:"configuration,attr"`
	Bound         *string `xml:"bound,attr"`
}

type Section

type Section struct {
	Required *bool  `xml:"required,attr"`
	Info     string `xml:"Info"`
	Category string `xml:"Category"`
}

type StorageAllocationSettingData added in v0.22.0

type StorageAllocationSettingData struct {
	CIMStorageAllocationSettingData

	Required      *bool   `xml:"required,attr"`
	Configuration *string `xml:"configuration,attr"`
	Bound         *string `xml:"bound,attr"`
}

type VirtualDiskDesc

type VirtualDiskDesc struct {
	DiskID                  string  `xml:"diskId,attr"`
	FileRef                 *string `xml:"fileRef,attr"`
	Capacity                string  `xml:"capacity,attr"`
	CapacityAllocationUnits *string `xml:"capacityAllocationUnits,attr"`
	Format                  *string `xml:"format,attr"`
	PopulatedSize           *int    `xml:"populatedSize,attr"`
	ParentRef               *string `xml:"parentRef,attr"`
}

type VirtualHardwareSection

type VirtualHardwareSection struct {
	Section

	ID        *string `xml:"id,attr"`
	Transport *string `xml:"transport,attr"`

	System      *VirtualSystemSettingData       `xml:"System"`
	Item        []ResourceAllocationSettingData `xml:"Item"`
	StorageItem []StorageAllocationSettingData  `xml:"StorageItem"`
	Config      []Config                        `xml:"Config"`
	ExtraConfig []Config                        `xml:"ExtraConfig"`
}

type VirtualSystem

type VirtualSystem struct {
	Content

	Annotation      []AnnotationSection      `xml:"AnnotationSection"`
	Product         []ProductSection         `xml:"ProductSection"`
	OperatingSystem []OperatingSystemSection `xml:"OperatingSystemSection"`
	Eula            []EulaSection            `xml:"EulaSection"`
	VirtualHardware []VirtualHardwareSection `xml:"VirtualHardwareSection"`
}

type VirtualSystemSettingData

type VirtualSystemSettingData struct {
	CIMVirtualSystemSettingData
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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