Dela via


VirtualMachine Interface

Implements

public interface VirtualMachine
extends GroupableResource<ComputeManager,VirtualMachineInner>, Refreshable<VirtualMachine>, Updatable<Update>, HasNetworkInterfaces

An immutable client-side representation of an Azure virtual machine.

Method Summary

Modifier and Type Method and Description
abstract String availabilitySetId()
abstract Set<AvailabilityZoneId> availabilityZones()
abstract PagedIterable<VirtualMachineSize> availableSizes()

Lists all available virtual machine sizes this virtual machine can resized to.

abstract BillingProfile billingProfile()
abstract String bootDiagnosticsStorageUri()
abstract String capture(String containerName, String vhdPrefix, boolean overwriteVhd)

Captures the virtual machine by copying virtual hard disks of the VM.

abstract Mono<String> captureAsync(String containerName, String vhdPrefix, boolean overwriteVhd)

Captures the virtual machine by copying virtual hard disks of the VM asynchronously.

abstract String computerName()
abstract void convertToManaged()

Converts (migrates) the virtual machine with un-managed disks to use managed disk.

abstract Mono<Void> convertToManagedAsync()

Converts (migrates) the virtual machine with un-managed disks to use managed disk asynchronously.

abstract Map<Integer,VirtualMachineDataDisk> dataDisks()
abstract void deallocate()

Shuts down the virtual machine and releases the compute resources.

abstract void deallocate(boolean hibernate)

Shuts down the virtual machine and releases the compute resources.

abstract Mono<Void> deallocateAsync()

Shuts down the virtual machine and releases the compute resources asynchronously.

abstract Mono<Void> deallocateAsync(boolean hibernate)

Shuts down the virtual machine and releases the compute resources asynchronously.

abstract DiagnosticsProfile diagnosticsProfile()
abstract VirtualMachineEncryption diskEncryption()
abstract VirtualMachineEvictionPolicyTypes evictionPolicy()
abstract void generalize()

Generalizes the virtual machine.

abstract Mono<Void> generalizeAsync()

Generalizes the virtual machine asynchronously.

abstract PublicIpAddress getPrimaryPublicIPAddress()

Gets the public IP address associated with this virtual machine's primary network interface.

abstract String getPrimaryPublicIPAddressId()
abstract VirtualMachineInstanceView instanceView()

Get the virtual machine instance view.

abstract boolean isBootDiagnosticsEnabled()
abstract boolean isEncryptionAtHost()
abstract boolean isHibernationEnabled()
abstract boolean isManagedDiskEnabled()
abstract boolean isManagedServiceIdentityEnabled()
abstract boolean isOSDiskEphemeral()
abstract boolean isSecureBootEnabled()
abstract boolean isVTpmEnabled()
abstract String licenseType()
abstract Map<String,VirtualMachineExtension> listExtensions()
abstract Mono<List<VirtualMachineExtension>> listExtensionsAsync()
abstract ResourceIdentityType managedServiceIdentityType()
abstract DeleteOptions networkInterfaceDeleteOptions(String networkInterfaceId)

Gets the delete options for the given network interface.

abstract CachingTypes osDiskCachingType()
abstract DeleteOptions osDiskDeleteOptions()
abstract String osDiskDiskEncryptionSetId()
abstract String osDiskId()
abstract int osDiskSize()
abstract StorageAccountTypes osDiskStorageAccountType()
abstract OSProfile osProfile()
abstract OperatingSystemTypes osType()
abstract String osUnmanagedDiskVhdUri()
abstract Plan plan()
abstract void powerOff()

Powers off (stops) the virtual machine.

abstract void powerOff(boolean skipShutdown)

Stops the virtual machine.

abstract Mono<Void> powerOffAsync()

Powers off (stops) the virtual machine asynchronously.

abstract Mono<Void> powerOffAsync(boolean skipShutdown)

Stops the virtual machine.

abstract PowerState powerState()
abstract DeleteOptions primaryNetworkInterfaceDeleteOptions()

Gets the delete options for the primary network interface.

abstract VirtualMachinePriorityTypes priority()
abstract String provisioningState()
abstract ProximityPlacementGroup proximityPlacementGroup()

Get specifies information about the proximity placement group that the virtual machine scale set should be assigned to.

abstract void redeploy()

Redeploys the virtual machine.

abstract Mono<Void> redeployAsync()

Redeploys the virtual machine asynchronously.

abstract VirtualMachineInstanceView refreshInstanceView()

Refreshes the virtual machine instance view to sync with Azure.

abstract Mono<VirtualMachineInstanceView> refreshInstanceViewAsync()

Refreshes the virtual machine instance view to sync with Azure.

abstract void restart()

Restarts the virtual machine.

abstract Mono<Void> restartAsync()

Restarts the virtual machine asynchronously.

abstract RunCommandResult runCommand(RunCommandInput inputCommand)

Run commands in the virtual machine.

abstract Mono<RunCommandResult> runCommandAsync(RunCommandInput inputCommand)

Run commands in the virtual machine asynchronously.

abstract RunCommandResult runPowerShellScript(List<String> scriptLines, List<RunCommandInputParameter> scriptParameters)

Run shell script in a virtual machine.

abstract Mono<RunCommandResult> runPowerShellScriptAsync(List<String> scriptLines, List<RunCommandInputParameter> scriptParameters)

Run shell script in the virtual machine asynchronously.

abstract RunCommandResult runShellScript(List<String> scriptLines, List<RunCommandInputParameter> scriptParameters)

Run shell script in the virtual machine.

abstract Mono<RunCommandResult> runShellScriptAsync(List<String> scriptLines, List<RunCommandInputParameter> scriptParameters)

Run shell script in the virtual machine asynchronously.

abstract SecurityTypes securityType()
abstract void simulateEviction()

Simulates the eviction of spot virtual machine.

abstract Mono<Void> simulateEvictionAsync()

Simulates the eviction of spot virtual machine asynchronously.

abstract VirtualMachineSizeTypes size()
abstract void start()

Starts the virtual machine.

abstract Mono<Void> startAsync()

Starts the virtual machine asynchronously.

abstract StorageProfile storageProfile()

Returns the storage profile of an Azure virtual machine.

abstract String systemAssignedManagedServiceIdentityPrincipalId()
abstract String systemAssignedManagedServiceIdentityTenantId()
abstract OffsetDateTime timeCreated()
abstract Map<Integer,VirtualMachineUnmanagedDataDisk> unmanagedDataDisks()
abstract Set<String> userAssignedManagedServiceIdentityIds()
abstract String userData()

Gets the base64 encoded user data for the virtual machine.

abstract String virtualMachineScaleSetId()
abstract String vmId()

Method Details

availabilitySetId

public abstract String availabilitySetId()

Returns:

the resource ID of the availability set associated with this virtual machine

availabilityZones

public abstract Set availabilityZones()

Returns:

the availability zones assigned to the virtual machine

availableSizes

public abstract PagedIterable availableSizes()

Lists all available virtual machine sizes this virtual machine can resized to.

Returns:

the virtual machine sizes

billingProfile

public abstract BillingProfile billingProfile()

Returns:

the billing related details of a low priority virtual machine

bootDiagnosticsStorageUri

public abstract String bootDiagnosticsStorageUri()

Returns:

the storage blob endpoint uri if boot diagnostics is enabled for the virtual machine

capture

public abstract String capture(String containerName, String vhdPrefix, boolean overwriteVhd)

Captures the virtual machine by copying virtual hard disks of the VM.

Parameters:

containerName - destination container name to store the captured VHD
vhdPrefix - the prefix for the VHD holding captured image
overwriteVhd - whether to overwrites destination VHD if it exists

Returns:

the JSON template for creating more such virtual machines

captureAsync

public abstract Mono captureAsync(String containerName, String vhdPrefix, boolean overwriteVhd)

Captures the virtual machine by copying virtual hard disks of the VM asynchronously.

Parameters:

containerName - destination container name to store the captured VHD
vhdPrefix - the prefix for the VHD holding captured image
overwriteVhd - whether to overwrites destination VHD if it exists

Returns:

a representation of the deferred computation of this call

computerName

public abstract String computerName()

Returns:

name of this virtual machine

convertToManaged

public abstract void convertToManaged()

Converts (migrates) the virtual machine with un-managed disks to use managed disk.

convertToManagedAsync

public abstract Mono convertToManagedAsync()

Converts (migrates) the virtual machine with un-managed disks to use managed disk asynchronously.

Returns:

a representation of the deferred computation of this call

dataDisks

public abstract Map dataDisks()

Returns:

the managed data disks associated with this virtual machine, indexed by LUN

deallocate

public abstract void deallocate()

Shuts down the virtual machine and releases the compute resources.

deallocate

public abstract void deallocate(boolean hibernate)

Shuts down the virtual machine and releases the compute resources.

Parameters:

hibernate - hibernate the virtual machine

deallocateAsync

public abstract Mono deallocateAsync()

Shuts down the virtual machine and releases the compute resources asynchronously.

Returns:

a representation of the deferred computation of this call

deallocateAsync

public abstract Mono deallocateAsync(boolean hibernate)

Shuts down the virtual machine and releases the compute resources asynchronously.

Parameters:

hibernate - hibernate the virtual machine

Returns:

a representation of the deferred computation of this call

diagnosticsProfile

public abstract DiagnosticsProfile diagnosticsProfile()

Returns:

the diagnostics profile

diskEncryption

public abstract VirtualMachineEncryption diskEncryption()

Returns:

entry point to enabling, disabling and querying disk encryption

evictionPolicy

public abstract VirtualMachineEvictionPolicyTypes evictionPolicy()

Returns:

the eviction policy for the virtual machine.

generalize

public abstract void generalize()

Generalizes the virtual machine.

generalizeAsync

public abstract Mono generalizeAsync()

Generalizes the virtual machine asynchronously.

Returns:

a representation of the deferred computation of this call

getPrimaryPublicIPAddress

public abstract PublicIpAddress getPrimaryPublicIPAddress()

Gets the public IP address associated with this virtual machine's primary network interface.

Note that this method makes a rest API call to fetch the resource.

Returns:

the public IP of the primary network interface

getPrimaryPublicIPAddressId

public abstract String getPrimaryPublicIPAddressId()

Returns:

the resource ID of the public IP address associated with this virtual machine's primary network interface

instanceView

public abstract VirtualMachineInstanceView instanceView()

Get the virtual machine instance view.

The instance view will be cached for later retrieval using instanceView.

Returns:

the virtual machine's instance view

isBootDiagnosticsEnabled

public abstract boolean isBootDiagnosticsEnabled()

Returns:

true if boot diagnostics is enabled for the virtual machine

isEncryptionAtHost

public abstract boolean isEncryptionAtHost()

Returns:

whether encryption at host

isHibernationEnabled

public abstract boolean isHibernationEnabled()

Returns:

true if hibernation feature is enabled on the virtual machine.

isManagedDiskEnabled

public abstract boolean isManagedDiskEnabled()

Returns:

true if managed disks are used for the virtual machine's disks (OS, data)

isManagedServiceIdentityEnabled

public abstract boolean isManagedServiceIdentityEnabled()

Returns:

true if Managed Service Identity is enabled for the virtual machine

isOSDiskEphemeral

public abstract boolean isOSDiskEphemeral()

Returns:

whether the os disk is ephemeral

isSecureBootEnabled

public abstract boolean isSecureBootEnabled()

Returns:

whether secure boot is enabled on the virtual machine

isVTpmEnabled

public abstract boolean isVTpmEnabled()

Returns:

whether vTPM is enabled on the virtual machine

licenseType

public abstract String licenseType()

Returns:

the licenseType value

listExtensions

public abstract Map listExtensions()

Returns:

extensions attached to the virtual machine

listExtensionsAsync

public abstract Mono<>> listExtensionsAsync()

Returns:

a representation of the deferred computation of this call, returning extensions attached to the virtual machine

managedServiceIdentityType

public abstract ResourceIdentityType managedServiceIdentityType()

Returns:

the type of Managed Service Identity used for the virtual machine.

networkInterfaceDeleteOptions

public abstract DeleteOptions networkInterfaceDeleteOptions(String networkInterfaceId)

Gets the delete options for the given network interface.

Parameters:

networkInterfaceId - resource ID of the network interface

Returns:

the delete options for the network interface

osDiskCachingType

public abstract CachingTypes osDiskCachingType()

Returns:

the operating system disk caching type

osDiskDeleteOptions

public abstract DeleteOptions osDiskDeleteOptions()

Returns:

the delete options of the OS disk

osDiskDiskEncryptionSetId

public abstract String osDiskDiskEncryptionSetId()

Returns:

resource ID of the disk encryption set of the OS disk

osDiskId

public abstract String osDiskId()

Returns:

resource ID of the managed disk backing the OS disk

osDiskSize

public abstract int osDiskSize()

Returns:

the size of the operating system disk in GB

osDiskStorageAccountType

public abstract StorageAccountTypes osDiskStorageAccountType()

Returns:

the storage account type of the managed disk backing OS disk

osProfile

public abstract OSProfile osProfile()

Returns:

the operating system profile

osType

public abstract OperatingSystemTypes osType()

Returns:

the operating system of this virtual machine

osUnmanagedDiskVhdUri

public abstract String osUnmanagedDiskVhdUri()

Returns:

the URI to the VHD file backing this virtual machine's operating system disk

plan

public abstract Plan plan()

Returns:

the plan value

powerOff

public abstract void powerOff()

Powers off (stops) the virtual machine.

powerOff

public abstract void powerOff(boolean skipShutdown)

Stops the virtual machine.

Parameters:

skipShutdown - power off without graceful shutdown

powerOffAsync

public abstract Mono powerOffAsync()

Powers off (stops) the virtual machine asynchronously.

Returns:

a representation of the deferred computation of this call

powerOffAsync

public abstract Mono powerOffAsync(boolean skipShutdown)

Stops the virtual machine.

Parameters:

skipShutdown - power off without graceful shutdown

Returns:

a representation of the deferred computation of this call.

powerState

public abstract PowerState powerState()

Returns:

the power state of the virtual machine

primaryNetworkInterfaceDeleteOptions

public abstract DeleteOptions primaryNetworkInterfaceDeleteOptions()

Gets the delete options for the primary network interface.

Returns:

the delete options for the primary network interface

priority

public abstract VirtualMachinePriorityTypes priority()

Returns:

the priority for the virtual machine.

provisioningState

public abstract String provisioningState()

Returns:

the provisioningState value

proximityPlacementGroup

public abstract ProximityPlacementGroup proximityPlacementGroup()

Get specifies information about the proximity placement group that the virtual machine scale set should be assigned to.

Returns:

the proximityPlacementGroup.

redeploy

public abstract void redeploy()

Redeploys the virtual machine.

redeployAsync

public abstract Mono redeployAsync()

Redeploys the virtual machine asynchronously.

Returns:

a representation of the deferred computation of this call

refreshInstanceView

public abstract VirtualMachineInstanceView refreshInstanceView()

Refreshes the virtual machine instance view to sync with Azure.

The instance view will be cached for later retrieval using instanceView.

Returns:

the refreshed instance view

refreshInstanceViewAsync

public abstract Mono refreshInstanceViewAsync()

Refreshes the virtual machine instance view to sync with Azure.

Returns:

an observable that emits the instance view of the virtual machine.

restart

public abstract void restart()

Restarts the virtual machine.

restartAsync

public abstract Mono restartAsync()

Restarts the virtual machine asynchronously.

Returns:

a representation of the deferred computation of this call

runCommand

public abstract RunCommandResult runCommand(RunCommandInput inputCommand)

Run commands in the virtual machine.

Parameters:

inputCommand - command input

Returns:

result of execution

runCommandAsync

public abstract Mono runCommandAsync(RunCommandInput inputCommand)

Run commands in the virtual machine asynchronously.

Parameters:

inputCommand - command input

Returns:

handle to the asynchronous execution

runPowerShellScript

public abstract RunCommandResult runPowerShellScript(List scriptLines, List scriptParameters)

Run shell script in a virtual machine.

Parameters:

scriptLines - PowerShell script lines
scriptParameters - script parameters

Returns:

result of PowerShell script execution

runPowerShellScriptAsync

public abstract Mono runPowerShellScriptAsync(List scriptLines, List scriptParameters)

Run shell script in the virtual machine asynchronously.

Parameters:

scriptLines - PowerShell script lines
scriptParameters - script parameters

Returns:

handle to the asynchronous execution

runShellScript

public abstract RunCommandResult runShellScript(List scriptLines, List scriptParameters)

Run shell script in the virtual machine.

Parameters:

scriptLines - shell script lines
scriptParameters - script parameters

Returns:

result of shell script execution

runShellScriptAsync

public abstract Mono runShellScriptAsync(List scriptLines, List scriptParameters)

Run shell script in the virtual machine asynchronously.

Parameters:

scriptLines - shell script lines
scriptParameters - script parameters

Returns:

handle to the asynchronous execution

securityType

public abstract SecurityTypes securityType()

Returns:

the SecurityTypes of the virtual machine

simulateEviction

public abstract void simulateEviction()

Simulates the eviction of spot virtual machine. The eviction will occur with 30 minutes after calling this API.

simulateEvictionAsync

public abstract Mono simulateEvictionAsync()

Simulates the eviction of spot virtual machine asynchronously. The eviction will occur with 30 minutes after calling this API.

Returns:

a representation of the deferred computation of this call

size

public abstract VirtualMachineSizeTypes size()

Returns:

the virtual machine size

start

public abstract void start()

Starts the virtual machine.

startAsync

public abstract Mono startAsync()

Starts the virtual machine asynchronously.

Returns:

a representation of the deferred computation of this call

storageProfile

public abstract StorageProfile storageProfile()

Returns the storage profile of an Azure virtual machine.

Returns:

the storageProfile value

systemAssignedManagedServiceIdentityPrincipalId

public abstract String systemAssignedManagedServiceIdentityPrincipalId()

Returns:

the System Assigned (Local) Managed Service Identity specific Active Directory service principal ID assigned to the virtual machine.

systemAssignedManagedServiceIdentityTenantId

public abstract String systemAssignedManagedServiceIdentityTenantId()

Returns:

the System Assigned (Local) Managed Service Identity specific Active Directory tenant ID assigned to the virtual machine.

timeCreated

public abstract OffsetDateTime timeCreated()

Returns:

the time at which the Virtual Machine resource was created

unmanagedDataDisks

public abstract Map unmanagedDataDisks()

Returns:

the unmanaged data disks associated with this virtual machine, indexed by LUN number

userAssignedManagedServiceIdentityIds

public abstract Set userAssignedManagedServiceIdentityIds()

Returns:

the resource ids of User Assigned Managed Service Identities associated with the virtual machine.

userData

public abstract String userData()

Gets the base64 encoded user data for the virtual machine.

Returns:

the base64 encoded user data for the virtual machine.

virtualMachineScaleSetId

public abstract String virtualMachineScaleSetId()

Returns:

the resource ID of the virtual machine scale set associated with this virtual machine

vmId

public abstract String vmId()

Returns:

the virtual machine unique ID.

Applies to