vcenter

package
v0.30.7 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2023 License: Apache-2.0 Imports: 11 Imported by: 14

Documentation

Index

Constants

View Source
const (
	ClassDeploymentOptionParams = "com.vmware.vcenter.ovf.deployment_option_params"
	ClassPropertyParams         = "com.vmware.vcenter.ovf.property_params"
	TypeDeploymentOptionParams  = "DeploymentOptionParams"
	TypeExtraConfigParams       = "ExtraConfigParams"
	TypeIPAllocationParams      = "IpAllocationParams"
	TypePropertyParams          = "PropertyParams"
	TypeSizeParams              = "SizeParams"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AdditionalParams

type AdditionalParams struct {
	Class string `json:"@class"`
	Type  string `json:"type"`

	// DeploymentOptionParams
	SelectedKey       string             `json:"selected_key,omitempty"`
	DeploymentOptions []DeploymentOption `json:"deployment_options,omitempty"`

	// ExtraConfigs
	ExtraConfig []ExtraConfig `json:"extra_configs,omitempty"`

	// PropertyParams
	Properties []Property `json:"properties,omitempty"`

	// SizeParams
	ApproximateSparseDeploymentSize int64 `json:"approximate_sparse_deployment_size,omitempty"`
	VariableDiskSize                bool  `json:"variable_disk_size,omitempty"`
	ApproximateDownloadSize         int64 `json:"approximate_download_size,omitempty"`
	ApproximateFlatDeploymentSize   int64 `json:"approximate_flat_deployment_size,omitempty"`

	// IpAllocationParams
	SupportedAllocationScheme   []string `json:"supported_allocation_scheme,omitempty"`
	SupportedIPProtocol         []string `json:"supported_ip_protocol,omitempty"`
	SupportedIPAllocationPolicy []string `json:"supported_ip_allocation_policy,omitempty"`
	IPAllocationPolicy          string   `json:"ip_allocation_policy,omitempty"`
	IPProtocol                  string   `json:"ip_protocol,omitempty"`

	// UnknownSections
	UnknownSections []UnknownSection `json:"unknown_sections,omitempty"`
}

AdditionalParams are additional OVF parameters which can be specified for a deployment target. This structure is a union where based on Type, only one of each commented section will be set.

type CPU added in v0.28.0

type CPU struct {
	CoresPerSocket int `json:"cores_per_socket,omitempty"`
	Count          int `json:"count,omitempty"`
}

CPU defines Cores and CPU count

type CheckIn added in v0.22.0

type CheckIn struct {
	Message string `json:"message"`
}

CheckIn specification

type CheckOut added in v0.22.0

type CheckOut struct {
	Name      string     `json:"name,omitempty"`
	Placement *Placement `json:"placement,omitempty"`
	PoweredOn bool       `json:"powered_on,omitempty"`
}

CheckOut specification

type CreateResult added in v0.23.0

type CreateResult struct {
	Succeeded bool             `json:"succeeded,omitempty"`
	ID        string           `json:"ovf_library_item_id,omitempty"`
	Error     *DeploymentError `json:"error,omitempty"`
}

CreateResult used for decoded a CreateOVF response

type CreateSpec added in v0.23.0

type CreateSpec struct {
	Description string   `json:"description,omitempty"`
	Name        string   `json:"name,omitempty"`
	Flags       []string `json:"flags,omitempty"`
}

CreateSpec info used to create an OVF package from a VM

type Deploy

type Deploy struct {
	DeploymentSpec `json:"deployment_spec,omitempty"`
	Target         `json:"target,omitempty"`
}

Deploy contains the information to start the deployment of a library OVF

type DeployTemplate added in v0.22.0

type DeployTemplate struct {
	Description           string                 `json:"description,omitempty"`
	DiskStorage           *DiskStorage           `json:"disk_storage,omitempty"`
	DiskStorageOverrides  []DiskStorageOverride  `json:"disk_storage_overrides,omitempty"`
	GuestCustomization    *GuestCustomization    `json:"guest_customization,omitempty"`
	HardwareCustomization *HardwareCustomization `json:"hardware_customization,omitempty"`
	Name                  string                 `json:"name,omitempty"`
	Placement             *Placement             `json:"placement,omitempty"`
	PoweredOn             bool                   `json:"powered_on"`
	VMHomeStorage         *DiskStorage           `json:"vm_home_storage,omitempty"`
}

DeployTemplate specification of how a library VM template clone should be deployed.

type Deployment

type Deployment struct {
	Succeeded  bool             `json:"succeeded,omitempty"`
	ResourceID *ResourceID      `json:"resource_id,omitempty"`
	Error      *DeploymentError `json:"error,omitempty"`
}

Deployment is the results from issuing a library OVF deployment

type DeploymentError

type DeploymentError struct {
	Errors []OVFError `json:"errors,omitempty"`
}

DeploymentError is an error that occurs when deploying and OVF from a library item.

func (*DeploymentError) Error

func (e *DeploymentError) Error() string

Error implements the error interface

type DeploymentOption

type DeploymentOption struct {
	Key           string `json:"key,omitempty"`
	Label         string `json:"label,omitempty"`
	Description   string `json:"description,omitempty"`
	DefaultChoice bool   `json:"default_choice,omitempty"`
}

DeploymentOption contains the information about a deployment option as defined in the OVF specification

type DeploymentSpec

type DeploymentSpec struct {
	Name                string             `json:"name,omitempty"`
	Annotation          string             `json:"annotation,omitempty"`
	AcceptAllEULA       bool               `json:"accept_all_EULA,omitempty"`
	NetworkMappings     []NetworkMapping   `json:"network_mappings,omitempty"`
	StorageMappings     []StorageMapping   `json:"storage_mappings,omitempty"`
	StorageProvisioning string             `json:"storage_provisioning,omitempty"`
	StorageProfileID    string             `json:"storage_profile_id,omitempty"`
	Locale              string             `json:"locale,omitempty"`
	Flags               []string           `json:"flags,omitempty"`
	AdditionalParams    []AdditionalParams `json:"additional_parameters,omitempty"`
	DefaultDatastoreID  string             `json:"default_datastore_id,omitempty"`
	VmConfigSpec        *VmConfigSpec      `json:"vm_config_spec,omitempty"`
}

DeploymentSpec is the deployment specification for the deployment

type DiskInfo added in v0.28.0

type DiskInfo struct {
	Capacity    int         `json:"capacity,omitempty"`
	DiskStorage DiskStorage `json:"disk_storage,omitempty"`
}

DiskInfo defines disk capacity and storage info

type DiskStorage added in v0.22.0

type DiskStorage struct {
	Datastore     string         `json:"datastore,omitempty"`
	StoragePolicy *StoragePolicy `json:"storage_policy,omitempty"`
}

DiskStorage defines the storage specification for VM files

type DiskStorageOverride added in v0.22.0

type DiskStorageOverride struct {
	Key   string      `json:"key"`
	Value DiskStorage `json:"value"`
}

DiskStorageOverride storage specification for individual disks in the virtual machine template

type Disks added in v0.28.0

type Disks struct {
	Key   string    `json:"key"`
	Value *DiskInfo `json:"value"`
}

Disks defines the disk information

type Error

type Error struct {
	Class    string                    `json:"@class,omitempty"`
	Messages []rest.LocalizableMessage `json:"messages,omitempty"`
}

Error is a SERVER error

type ExtraConfig

type ExtraConfig struct {
	Key             string `json:"key,omitempty"`
	Value           string `json:"value,omitempty"`
	VirtualSystemID string `json:"virtual_system_id,omitempty"`
}

ExtraConfig contains information about a vmw:ExtraConfig OVF element

type FilterRequest

type FilterRequest struct {
	Target `json:"target,omitempty"`
}

FilterRequest contains the information to start a vcenter filter call

type FilterResponse

type FilterResponse struct {
	EULAs            []string           `json:"EULAs,omitempty"`
	AdditionalParams []AdditionalParams `json:"additional_params,omitempty"`
	Annotation       string             `json:"Annotation,omitempty"`
	Name             string             `json:"name,omitempty"`
	Networks         []string           `json:"Networks,omitempty"`
	StorageGroups    []string           `json:"storage_groups,omitempty"`
}

FilterResponse returns information from the vcenter filter call

type GuestCustomization added in v0.22.0

type GuestCustomization struct {
	Name string `json:"name,omitempty"`
}

GuestCustomization spec to apply to the deployed VM

type HardwareCustomization added in v0.22.0

type HardwareCustomization struct {
}

HardwareCustomization spec which specifies updates to the deployed VM

type LibraryTarget added in v0.23.0

type LibraryTarget struct {
	LibraryID     string `json:"library_id,omitempty"`
	LibraryItemID string `json:"library_item_id,omitempty"`
}

LibraryTarget specifies a Library or Library item

type Manager

type Manager struct {
	*rest.Client
}

Manager extends rest.Client, adding content library related methods.

func NewManager

func NewManager(client *rest.Client) *Manager

NewManager creates a new Manager instance with the given client.

func (*Manager) CheckIn added in v0.22.0

func (c *Manager) CheckIn(ctx context.Context, libraryItemID string, vm mo.Reference, checkin *CheckIn) (string, error)

CheckIn a VM into the library item.

func (*Manager) CheckOut added in v0.22.0

func (c *Manager) CheckOut(ctx context.Context, libraryItemID string, checkout *CheckOut) (*types.ManagedObjectReference, error)

CheckOut a library item containing a VM template.

func (*Manager) CreateOVF added in v0.23.0

func (c *Manager) CreateOVF(ctx context.Context, ovf OVF) (string, error)

CreateOVF creates a library OVF item in content library from an existing VM

func (*Manager) CreateTemplate added in v0.22.0

func (c *Manager) CreateTemplate(ctx context.Context, vmtx Template) (string, error)

CreateTemplate creates a library VMTX item in content library from an existing VM

func (*Manager) DeployLibraryItem

func (c *Manager) DeployLibraryItem(ctx context.Context, libraryItemID string, deploy Deploy) (*types.ManagedObjectReference, error)

DeployLibraryItem deploys a library OVF

func (*Manager) DeployTemplateLibraryItem added in v0.22.0

func (c *Manager) DeployTemplateLibraryItem(ctx context.Context, libraryItemID string, deploy DeployTemplate) (*types.ManagedObjectReference, error)

DeployTemplateLibraryItem deploys a VM as a copy of the source VM template contained in the given library item

func (*Manager) FilterLibraryItem

func (c *Manager) FilterLibraryItem(ctx context.Context, libraryItemID string, filter FilterRequest) (FilterResponse, error)

FilterLibraryItem deploys a library OVF

func (*Manager) GetLibraryTemplateInfo added in v0.28.0

func (c *Manager) GetLibraryTemplateInfo(ctx context.Context, libraryItemID string) (*TemplateInfo, error)

GetLibraryTemplateInfo fetches the library template info using template library id

func (*Manager) SyncTemplateLibrary added in v0.22.0

func (c *Manager) SyncTemplateLibrary(ctx context.Context, l TemplateLibrary, items ...library.Item) error

SyncTemplateLibrary converts TemplateLibrary.Source OVF items to VM Template items within TemplateLibrary.Destination The optional TemplateLibrary.Include func can be used to filter which items are synced. By default all items that don't exist in the Destination library are synced. The optional TemplateLibrary.SyncItem func can be used to change how the item is synced, by default SyncTemplateLibraryItem is used.

func (*Manager) SyncTemplateLibraryItem added in v0.22.0

func (c *Manager) SyncTemplateLibraryItem(ctx context.Context, item library.Item, deploy *Deploy, spec *Template) error

SyncTemplateLibraryItem deploys an Library OVF item from which a VM template (vmtx) Library item is created. The deployed VM is deleted after being converted to a Library vmtx item.

type Memory added in v0.28.0

type Memory struct {
	SizeMB int `json:"size_mib,omitempty"`
}

Memory defines the memory size in MB

type NetworkMapping

type NetworkMapping struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

NetworkMapping specifies the target network to use for sections of type ovf:NetworkSection in the OVF descriptor

type NicDetails added in v0.28.0

type NicDetails struct {
	Network     string `json:"network,omitempty"`
	BackingType string `json:"backing_type,omitempty"`
	MacType     string `json:"mac_type,omitempty"`
}

NicDetails defines the network adapter details

type Nics added in v0.28.0

type Nics struct {
	Key   string      `json:"key,omitempty"`
	Value *NicDetails `json:"value,omitempty"`
}

Nics defines the network identifier

type OVF added in v0.23.0

type OVF struct {
	Spec   CreateSpec    `json:"create_spec"`
	Source ResourceID    `json:"source"`
	Target LibraryTarget `json:"target"`
}

OVF data used by CreateOVF

type OVFError

type OVFError struct {
	Category string                   `json:"category,omitempty"`
	Error    *Error                   `json:"error,omitempty"`
	Issues   []ParseIssue             `json:"issues,omitempty"`
	Message  *rest.LocalizableMessage `json:"message,omitempty"`
}

OVFError is a list of errors from create or deploy

type ParseIssue

type ParseIssue struct {
	Category     string                  `json:"@classcategory,omitempty"`
	File         string                  `json:"file,omitempty"`
	LineNumber   int64                   `json:"line_number,omitempty"`
	ColumnNumber int64                   `json:"column_number,omitempty"`
	Message      rest.LocalizableMessage `json:"message,omitempty"`
}

ParseIssue is a parse issue struct

type Placement added in v0.22.0

type Placement = library.Placement

Placement information used to place the virtual machine template

type Property

type Property struct {
	Category    string `json:"category,omitempty"`
	ClassID     string `json:"class_id,omitempty"`
	Description string `json:"description,omitempty"`
	ID          string `json:"id,omitempty"`
	InstanceID  string `json:"instance_id,omitempty"`
	Label       string `json:"label,omitempty"`
	Type        string `json:"type,omitempty"`
	UIOptional  bool   `json:"ui_optional,omitempty"`
	Value       string `json:"value,omitempty"`
}

Property contains information about a property in an OVF package

type ResourceID

type ResourceID struct {
	Type  string `json:"type,omitempty"`
	Value string `json:"id,omitempty"`
}

ResourceID is a managed object reference for a deployed resource.

type StorageGroupMapping

type StorageGroupMapping struct {
	Type             string `json:"type"`
	StorageProfileID string `json:"storage_profile_id,omitempty"`
	DatastoreID      string `json:"datastore_id,omitempty"`
	Provisioning     string `json:"provisioning,omitempty"`
}

StorageGroupMapping defines the storage deployment target and storage provisioning type for a section of type vmw:StorageGroupSection in the OVF descriptor

type StorageMapping

type StorageMapping struct {
	Key   string              `json:"key"`
	Value StorageGroupMapping `json:"value"`
}

StorageMapping specifies the target storage to use for sections of type vmw:StorageGroupSection in the OVF descriptor

type StoragePolicy added in v0.22.0

type StoragePolicy struct {
	Policy string `json:"policy,omitempty"`
	Type   string `json:"type"`
}

StoragePolicy for DiskStorage

type Target

type Target struct {
	ResourcePoolID string `json:"resource_pool_id,omitempty"`
	HostID         string `json:"host_id,omitempty"`
	FolderID       string `json:"folder_id,omitempty"`
}

Target is the target for the deployment

type Template added in v0.22.0

type Template struct {
	Description          string                `json:"description,omitempty"`
	DiskStorage          *DiskStorage          `json:"disk_storage,omitempty"`
	DiskStorageOverrides []DiskStorageOverride `json:"disk_storage_overrides,omitempty"`
	Library              string                `json:"library,omitempty"`
	Name                 string                `json:"name,omitempty"`
	Placement            *Placement            `json:"placement,omitempty"`
	SourceVM             string                `json:"source_vm,omitempty"`
	VMHomeStorage        *DiskStorage          `json:"vm_home_storage,omitempty"`
}

Template create spec

type TemplateInfo added in v0.22.0

type TemplateInfo struct {
	CPU           CPU         `json:"cpu,omitempty"`
	Disks         []Disks     `json:"disks,omitempty"`
	GuestOS       string      `json:"guest_OS,omitempty"`
	Memory        Memory      `json:"memory,omitempty"`
	Nics          []Nics      `json:"nics,omitempty"`
	VMHomeStorage DiskStorage `json:"vm_home_storage,omitempty"`
	VmTemplate    string      `json:"vm_template,omitempty"`
}

TemplateInfo for a VM template contained in an existing library item

type TemplateLibrary added in v0.22.0

type TemplateLibrary struct {
	Source      library.Library
	Destination library.Library
	Placement   Target
	Include     func(library.Item, *library.Item) bool
	SyncItem    func(context.Context, library.Item, *Deploy, *Template) error
}

TemplateLibrary params for synchronizing subscription library OVF items to VM Template items

type UnknownSection

type UnknownSection struct {
	Tag  string `json:"tag,omitempty"`
	Info string `json:"info,omitempty"`
}

UnknownSection contains information about an unknown section in an OVF package

type VmConfigSpec added in v0.29.0

type VmConfigSpec struct {
	Provider string `json:"provider"`
	XML      string `json:"xml"`
}

VmConfigSpec defines the optional virtual machine configuration settings used when deploying an OVF template

Jump to

Keyboard shortcuts

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