You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

405 lines
14 KiB

4 months ago
package requests
import "time"
// CreateVMRequest struct to create a virtual machine.
type CreateVMRequest struct {
// Parent template or VM uuid
// Required: false
ParentUUID string `url:"parent_uuid,omitempty" json:"parent_uuid,omitempty"`
// VM name
// Required: true
Name string `url:"name" json:"name" validate:"required"`
// VM description
// Required: false
Description string `url:"description,omitempty" json:"description,omitempty"`
// VM location on server
// Required: false
Location string `url:"location,omitempty" json:"location,omitempty"`
// Is HA mode enabled on VM
// Required: false
HaEnabled bool `url:"ha_enabled" json:"ha_enabled"`
// Current HA priority of VM
// Required: false
HaPriority int `url:"ha_priority" json:"ha_priority"`
// VM is infrastructure; specify ``True`` to mark VM as infrastructure
// Required: false
IsInfrastructure bool `url:"is_infrastructure" json:"is_infrastructure"`
// Is a monitoring via guest tools enabled on VM
// Required: false
MonitoringEnabled bool `url:"monitoring_enabled" json:"monitoring_enabled"`
// VM CPU units
// Required: false
CPUUnits int `url:"cpu_units,omitempty" json:"cpu_units,omitempty" validate:"omitempty,cpu_units"`
// VM CPU limit
// Required: false
CPULimit int `url:"cpu_limit" json:"cpu_limit"`
// Is CPU hotplug mode enabled
// Required: false
CPUHotplug bool `url:"cpu_hotplug,omitempty" json:"cpu_hotplug,omitempty"`
// CPU sockets
// Required: true
CPUSockets int `url:"cpu_sockets" json:"cpu_sockets" validate:"required"`
// CPU mask for a virtual machine
// Required: false
CPUMask string `url:"cpu_mask,omitempty" json:"cpu_mask,omitempty"`
// NUMA node mask for a virtual machine
// Required: false
NodeMask string `url:"node_mask,omitempty" json:"node_mask,omitempty"`
// Affinity rule type
// Required: false
Affinity string `url:"affinity,omitempty" json:"affinity,omitempty" validate:"omitempty,affinity"`
// Time delay used during the virtual machine automatic startup
// Required: false
AutoStartDelay int `url:"auto_start_delay,omitempty" json:"auto_start_delay,omitempty"`
// RAM size in Megabytes
// Required: true
RAMSize int `url:"ram_size,omitempty" json:"ram_size,omitempty" validate:"required"`
// Required guarantee memory in percent
// Required: false default -1
MemGuaranteeSize int `url:"mem_guarantee_size,omitempty" json:"mem_guarantee_size,omitempty" validate:"omitempty,mem_guarantee_size"`
// Is RAM hotplug enabled
// Required: false
RAMHotplugEnabled bool `url:"ram_hotplug_enabled,omitempty" json:"ram_hotplug_enabled,omitempty"`
// Video RAM size in Megabytes
// Required: true
VideoRAMSize int `url:"video_ram_size,omitempty" json:"video_ram_size,omitempty" validate:"required,video_ram"`
// VM guest OS type
// Required: false //validation
GuestOs string `url:"guest_os,omitempty" json:"guest_os,omitempty" validate:"omitempty,guest_os"`
// Is VM uses EFI instead of BIOS
// Required: false
EfiEnabled bool `url:"efi_enabled" json:"efi_enabled"`
// Enabled TMP
// Required: false
TpmEnabled bool `url:"tpm_enabled" json:"tpm_enabled"`
// is VM uses Secure Boot
// Required: false
SecureBoot bool `url:"secure_boot" json:"secure_boot"`
// VM disk I/O priority level
// Required: false ///0-7
IoPriority int `url:"io_priority,omitempty" json:"io_priority,omitempty" validate:"omitempty,io_priority"`
// Allowed bandwidth for VM disk I/O operations in bytes
// Required: false
IoLimit int `url:"io_limit,omitempty" json:"io_limit,omitempty"`
// IOPS limit for VM disk I/O operations
// Required: false
IopsLimit int `url:"iops_limit,omitempty" json:"iops_limit,omitempty"`
// If True don't move this VM by DRS auto balancing
// Required: false
DisableAutobalance bool `url:"disable_autobalance" json:"disable_autobalance"`
// If ``True``, the bandwidth guarantee (the global rate parameter) is also the limit for the virtual machine or container
// Required: false
Ratebound bool `url:"ratebound" json:"ratebound"`
// Boot devices order list
// Required: false
BootDeviceList []BootDevice `url:"-" json:"boot_device_list,omitempty"`
// VM CPU units
// Required: false
IPAddress any `url:"ip_address,omitempty" json:"ip_address,omitempty"`
// Guest Tools State
// Required: false
GuestToolsState string `url:"guest_tools_state,omitempty" json:"guest_tools_state,omitempty"`
// Should OS be installed after creation
// Required: false
InstallOs bool `url:"install_os,omitempty" json:"install_os,omitempty"`
// VNC server password
// Required: false
VncPassword string `url:"vnc_password,omitempty" json:"vnc_password,omitempty"`
// External storage name
// Required: false
ExternalStorageName string `url:"external_storage_name,omitempty" json:"external_storage_name,omitempty"`
// Linked vm uuid
// Required: false
LinkedVMUUID any `url:"linked_vm_uuid,omitempty" json:"linked_vm_uuid,omitempty"`
// Creation_date
// Required: false
CreationDate time.Time `url:"creation_date,omitempty" json:"creation_date,omitempty"`
// Imported
// Required: false
Imported bool `url:"imported,omitempty" json:"imported,omitempty"`
// Type of virtualization
// Required: false
VirtType string `url:"virt_type,omitempty" json:"virt_type,omitempty" validation:"omitempty,virt_type"`
// Used by dekstop
// Required: false
UsedByDesktop bool `url:"used_by_desktop,omitempty" json:"used_by_desktop,omitempty"`
// VNC server hostname
// Required: false
VncHostname string `url:"vnc_hostname,omitempty" json:"vnc_hostname,omitempty"`
// Ram total hotplug flag
// Required: false
RAMTotalHotplug any `url:"ram_total_hotplug,omitempty" json:"ram_total_hotplug,omitempty"`
// Linked VM ID
// Required: false
LinkedVMID any `url:"linked_vm_id,omitempty" json:"linked_vm_id,omitempty"`
// Ram balloon actual hotplug
// Required: false
RAMBalloonActualHotplug any `url:"ram_balloon_actual_hotplug,omitempty" json:"ram_balloon_actual_hotplug,omitempty"`
// Smbios uuid
// Required: false
SmbiosUUID string `url:"smbios_uuid,omitempty" json:"smbios_uuid,omitempty"`
// Parent template or VM uuid
// Required: false
UUID string `url:"uuid,omitempty" json:"uuid,omitempty"`
// Name of external resource
// Required: false
ExternalResourceName string `url:"external_resource_name,omitempty" json:"external_resource_name,omitempty"`
// HA Status
// Required: false
HaStatus string `url:"ha_status,omitempty" json:"ha_status,omitempty"`
// External uuid
// Required: false
ExternalUUID any `url:"external_uuid,omitempty" json:"external_uuid,omitempty"`
// Time of deleted
// Required: false
Deleted any `url:"deleted,omitempty" json:"deleted,omitempty"`
// VM's System flags
// Required: false
SystemFlags string `url:"system_flags,omitempty" json:"system_flags,omitempty"`
// VM is template; specify ``True`` to create master for linked clone VM
// Required: false
IsVzTemplate bool `url:"is_vz_template,omitempty" json:"is_vz_template,omitempty"`
// VNC port
// Required: false //validate
VncPort int `url:"vnc_port,omitempty" json:"vnc_port,omitempty"`
// status
// Required: false
Status string `url:"status,omitempty" json:"status,omitempty"`
// vm id
// Required: false
VMID int `url:"vm_id,omitempty" json:"vm_id,omitempty"`
// MaxRamSize
// Required: false
MaxRAMSize int `url:"max_ram_size,omitempty" json:"max_ram_size,omitempty"`
// Cores count
// Required: false
CoresCount int `url:"cores_count,omitempty" json:"cores_count,omitempty"`
// is template
// Required: false
IsTemplate bool `url:"is_template,omitempty" json:"is_template,omitempty"`
// max memory
// Required: false
Maxmemory int `url:"maxmemory,omitempty" json:"maxmemory,omitempty"`
// External resource id
// Required: false
ExternalResourceID any `url:"external_resource_id,omitempty" json:"external_resource_id,omitempty"`
// is linked clone
// Required: false
IsLinkedClone bool `url:"is_linked_clone,omitempty" json:"is_linked_clone,omitempty"`
// created time
// Required: false
Created time.Time `url:"created,omitempty" json:"created,omitempty"`
// list of mac addresses
// Required: false
MacAddresses any `url:"mac_addresses,omitempty" json:"mac_addresses,omitempty"`
// VM guest domain name
// Required: false
Domain string `url:"domain,omitempty" json:"domain,omitempty"`
// Count of linked clones
// Required: false
LinkedCloneCount int `url:"linked_clone_count,omitempty" json:"linked_clone_count,omitempty"`
// Count of snapshot
// Required: false
SnapshotCount int `url:"snapshot_count,omitempty" json:"snapshot_count,omitempty"`
// Count of device host
// Required: false
HostDeviceCount int `url:"host_device_count,omitempty" json:"host_device_count,omitempty"`
// All md5
// Required: false
AllMd5 bool `url:"all_md5,omitempty" json:"all_md5,omitempty"`
// Size of disks
// Required: false
DisksSize int `url:"disks_size,omitempty" json:"disks_size,omitempty"`
// Size of template
// Required: false
TemplateSize float64 `url:"template_size,omitempty" json:"template_size,omitempty"`
// Full hard drive size
// Required: false
FullHardDriveSize int `url:"full_hard_drive_size,omitempty" json:"full_hard_drive_size,omitempty"`
// Used hard drive size
// Required: false
UsedHardDriveSize float64 `url:"used_hard_drive_size,omitempty" json:"used_hard_drive_size,omitempty"`
// Cluster ID
// Required: false
ClusterID int `url:"cluster_id,omitempty" json:"cluster_id,omitempty"`
// External storage ID
// Required: false
ExternalStorageID int `url:"external_storage_id,omitempty" json:"external_storage_id,omitempty"`
// VM guest OS version
// Required: false
GuestOsVersion string `url:"guest_os_version,omitempty" json:"guest_os_version,omitempty" validate:"omitempty,guest_os_version"`
// Virtual machine startup options
// Required: false
AutoStart string `url:"auto_start,omitempty" json:"auto_start,omitempty" validate:"omitempty,auto_start"`
// Automatic shutdown mode
// Required: false
AutoStop string `url:"auto_stop,omitempty" json:"auto_stop,omitempty" validate:"omitempty,auto_stop"`
// VNC server mode
// Required: false
VncMode string `url:"vnc_mode,omitempty" json:"vnc_mode,omitempty" validate:"omitempty,vnc_mode"`
// VM CPU count
// Required: true
CPUCount int `url:"cpu_count,omitempty" json:"cpu_count,omitempty" validate:"required"`
// rates object
// Required: false
Rates struct{} `url:"rates,omitempty" json:"rates,omitempty"`
// List of VM names to create
// Required: false
Names []string `url:"names,omitempty" json:"names,omitempty"`
// List with devices dicts
// Required: false
Devices []Device `json:"devices,omitempty"`
// Host devices
// Required: false
HostDevices []int `url:"host_devices,omitempty" json:"host_devices,omitempty"`
// VM chipset
// Required: false
Chipset string `url:"chipset,omitempty" json:"chipset,omitempty" validate:"omitempty,chipset"`
// VM clock offset
// Required: false
ClockOffset string `url:"clock_offset,omitempty" json:"clock_offset,omitempty" validate:"omitempty,clock_offset"`
}
// struct from request JSON no have documentation
type Device struct {
Name any `json:"name,omitempty"`
Modified time.Time `json:"modified,omitempty"`
Status string `json:"status,omitempty"`
EmulationType string `json:"emulation_type,omitempty"`
Enabled bool `json:"enabled,omitempty"`
DeviceType string `json:"device_type,omitempty"`
VolumeID any `json:"volume_id,omitempty"`
IsSharedDisk bool `json:"is_shared_disk,omitempty"`
Size int `json:"size,omitempty"`
VMID int `json:"vm_id,omitempty"`
DeviceIndex int `json:"device_index,omitempty"`
DeviceID int `json:"device_id,omitempty"`
ExternalUUID any `json:"external_uuid,omitempty"`
Deleted any `json:"deleted,omitempty"`
Connected bool `json:"connected,omitempty"`
Created time.Time `json:"created,omitempty"`
ImageID int `json:"image_id,omitempty"`
UUID any `json:"uuid,omitempty"`
ExternalResourceID any `json:"external_resource_id,omitempty"`
ImagePath string `json:"image_path,omitempty"`
EditableParams []string `json:"editable_params,omitempty"`
ImageUUID string `json:"image_uuid,omitempty"`
ImageSource string `json:"image_source,omitempty"`
ImageMd5 string `json:"image_md5,omitempty"`
DiskCaches []any `json:"disk_caches,omitempty"`
ImageName string `json:"image_name,omitempty"`
ImageHashSum string `json:"image_hashSum,omitempty"`
Editing bool `json:"editing,omitempty"`
DiskType string `json:"disk_type,omitempty"`
InterfaceType string `json:"interface_type,omitempty"`
StackIndex int `json:"stack_index,omitempty"`
ExternalStorageID int `json:"external_storage_id,omitempty"`
TierID any `json:"tier_id,omitempty"`
ImageType string `json:"image_type,omitempty"`
IPAddress []any `json:"ip_address,omitempty"`
GuestIPAddress any `json:"guest_ip_address,omitempty"`
DefaultGateway any `json:"default_gateway,omitempty"`
DNSServers []any `json:"dns_servers,omitempty"`
SearchDomains []any `json:"search_domains,omitempty"`
AutoApply bool `json:"auto_apply,omitempty"`
MacAddress any `json:"mac_address,omitempty"`
NetworkName string `json:"network_name,omitempty"`
VirtualNetworkID int `json:"virtual_network_id,omitempty"`
AdapterType string `json:"adapter_type,omitempty"`
PreventIPSpoof bool `json:"prevent_ip_spoof,omitempty"`
PreventMacSpoof bool `json:"prevent_mac_spoof,omitempty"`
PreventPromisc bool `json:"prevent_promisc,omitempty"`
Autoconnect string `json:"autoconnect,omitempty"`
}
type BootDevice struct {
Type string `url:"type" json:"type" validate:"required"`
InUse bool `url:"in_use,omitempty" json:"in_use,omitempty"`
Index int `url:"index,omitempty" json:"index,omitempty"`
}