github.com/rahart/packer@v0.12.2-0.20161229105310-282bb6ad370f/builder/hyperv/common/driver.go (about)

     1  package common
     2  
     3  // A driver is able to talk to HyperV and perform certain
     4  // operations with it. Some of the operations on here may seem overly
     5  // specific, but they were built specifically in mind to handle features
     6  // of the HyperV builder for Packer, and to abstract differences in
     7  // versions out of the builder steps, so sometimes the methods are
     8  // extremely specific.
     9  type Driver interface {
    10  
    11  	// Checks if the VM named is running.
    12  	IsRunning(string) (bool, error)
    13  
    14  	// Checks if the VM named is off.
    15  	IsOff(string) (bool, error)
    16  
    17  	//How long has VM been on
    18  	Uptime(vmName string) (uint64, error)
    19  
    20  	// Start starts a VM specified by the name given.
    21  	Start(string) error
    22  
    23  	// Stop stops a VM specified by the name given.
    24  	Stop(string) error
    25  
    26  	// Verify checks to make sure that this driver should function
    27  	// properly. If there is any indication the driver can't function,
    28  	// this will return an error.
    29  	Verify() error
    30  
    31  	// Finds the MAC address of the NIC nic0
    32  	Mac(string) (string, error)
    33  
    34  	// Finds the IP address of a VM connected that uses DHCP by its MAC address
    35  	IpAddress(string) (string, error)
    36  
    37  	// Finds the hostname for the ip address
    38  	GetHostName(string) (string, error)
    39  
    40  	// Finds the IP address of a host adapter connected to switch
    41  	GetHostAdapterIpAddressForSwitch(string) (string, error)
    42  
    43  	// Type scan codes to virtual keyboard of vm
    44  	TypeScanCodes(string, string) error
    45  
    46  	//Get the ip address for network adaptor
    47  	GetVirtualMachineNetworkAdapterAddress(string) (string, error)
    48  
    49  	//Set the vlan to use for switch
    50  	SetNetworkAdapterVlanId(string, string) error
    51  
    52  	//Set the vlan to use for machine
    53  	SetVirtualMachineVlanId(string, string) error
    54  
    55  	UntagVirtualMachineNetworkAdapterVlan(string, string) error
    56  
    57  	CreateExternalVirtualSwitch(string, string) error
    58  
    59  	GetVirtualMachineSwitchName(string) (string, error)
    60  
    61  	ConnectVirtualMachineNetworkAdapterToSwitch(string, string) error
    62  
    63  	CreateVirtualSwitch(string, string) (bool, error)
    64  
    65  	DeleteVirtualSwitch(string) error
    66  
    67  	CreateVirtualMachine(string, string, int64, int64, string, uint) error
    68  
    69  	DeleteVirtualMachine(string) error
    70  
    71  	SetVirtualMachineCpuCount(string, uint) error
    72  
    73  	SetVirtualMachineMacSpoofing(string, bool) error
    74  
    75  	SetVirtualMachineDynamicMemory(string, bool) error
    76  
    77  	SetVirtualMachineSecureBoot(string, bool) error
    78  
    79  	SetVirtualMachineVirtualizationExtensions(string, bool) error
    80  
    81  	EnableVirtualMachineIntegrationService(string, string) error
    82  
    83  	ExportVirtualMachine(string, string) error
    84  
    85  	CompactDisks(string, string) error
    86  
    87  	CopyExportedVirtualMachine(string, string, string, string) error
    88  
    89  	RestartVirtualMachine(string) error
    90  
    91  	CreateDvdDrive(string, string, uint) (uint, uint, error)
    92  
    93  	MountDvdDrive(string, string, uint, uint) error
    94  
    95  	SetBootDvdDrive(string, uint, uint, uint) error
    96  
    97  	UnmountDvdDrive(string, uint, uint) error
    98  
    99  	DeleteDvdDrive(string, uint, uint) error
   100  
   101  	MountFloppyDrive(string, string) error
   102  
   103  	UnmountFloppyDrive(string) error
   104  }