共用方式為


VirtualMachines Interface

Implements

public interface VirtualMachines
extends SupportsListing<VirtualMachine>, SupportsListingByResourceGroup<VirtualMachine>, SupportsGettingByResourceGroup<VirtualMachine>, SupportsGettingById<VirtualMachine>, SupportsCreating<Blank>, SupportsDeletingById, SupportsDeletingByResourceGroup, SupportsBatchCreation<VirtualMachine>, SupportsBatchDeletion, HasManager<ComputeManager>

Entry point to virtual machine management API.

Method Summary

Modifier and Type Method and Description
abstract Accepted<Void> beginDeleteById(String id)

Begins deleting a virtual machine from Azure, identifying it by its resource ID.

abstract Accepted<Void> beginDeleteById(String id, boolean forceDeletion)

Begins force deleting a virtual machine from Azure, identifying it by its resource ID.

abstract Accepted<Void> beginDeleteByResourceGroup(String resourceGroupName, String name)

Begins deleting a virtual machine from Azure, identifying it by its name and its resource group.

abstract Accepted<Void> beginDeleteByResourceGroup(String resourceGroupName, String name, boolean forceDeletion)

Begins force deleting a virtual machine from Azure, identifying it by its name and its resource group.

abstract String capture(String groupName, String name, String containerName, String vhdPrefix, boolean overwriteVhd)

Captures the virtual machine by copying virtual hard disks of the VM and returns template as a JSON string that can be used to create similar VMs.

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

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

abstract void deallocate(String groupName, String name)

Shuts down the virtual machine and releases the compute resources.

abstract void deallocate(String groupName, String name, boolean hibernate)

Shuts down the virtual machine and releases the compute resources.

abstract Mono<Void> deallocateAsync(String groupName, String name)

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

abstract Mono<Void> deallocateAsync(String groupName, String name, boolean hibernate)

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

abstract void deleteById(String id, boolean forceDeletion)

Force delete a resource from Azure, identifying it by its resource ID.

abstract Mono<Void> deleteByIdAsync(String id, boolean forceDeletion)

Asynchronously force delete a resource from Azure, identifying it by its resource ID.

abstract void deleteByResourceGroup(String resourceGroupName, String name, boolean forceDeletion)

Force delete a resource from Azure, identifying it by its name and its resource group.

abstract Mono<Void> deleteByResourceGroupAsync(String resourceGroupName, String name, boolean forceDeletion)

Asynchronously force delete a resource from Azure, identifying it by its name and its resource group.

abstract void generalize(String groupName, String name)

Generalizes the virtual machine.

abstract Mono<Void> generalizeAsync(String groupName, String name)

Generalizes the virtual machine asynchronously.

abstract PagedIterable<VirtualMachine> listByVirtualMachineScaleSet(VirtualMachineScaleSet vmss)

Lists all the virtual machines by a certain virtual machine scale set with orchestration mode FLEXIBLE.

abstract PagedFlux<VirtualMachine> listByVirtualMachineScaleSetAsync(VirtualMachineScaleSet vmss)

Lists all the virtual machines by a certain virtual machine scale set with orchestration mode FLEXIBLE.

abstract PagedIterable<VirtualMachine> listByVirtualMachineScaleSetId(String vmssId)

Lists all the virtual machines by a certain virtual machine scale set with orchestration mode FLEXIBLE.

abstract PagedFlux<VirtualMachine> listByVirtualMachineScaleSetIdAsync(String vmssId)

Lists all the virtual machines by a certain virtual machine scale set with orchestration mode FLEXIBLE.

abstract void migrateToManaged(String groupName, String name)

Migrates the virtual machine with unmanaged disks to use managed disks.

abstract Mono<Void> migrateToManagedAsync(String groupName, String name)

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

abstract void powerOff(String groupName, String name)

Powers off (stops) a virtual machine.

abstract Mono<Void> powerOffAsync(String groupName, String name)

Powers off (stops) the virtual machine asynchronously.

abstract void redeploy(String groupName, String name)

Redeploys a virtual machine.

abstract Mono<Void> redeployAsync(String groupName, String name)

Redeploys the virtual machine asynchronously.

abstract void restart(String groupName, String name)

Restarts a virtual machine.

abstract Mono<Void> restartAsync(String groupName, String name)

Restarts the virtual machine asynchronously.

abstract RunCommandResult runCommand(String groupName, String name, RunCommandInput inputCommand)

Run commands in a virtual machine.

abstract Mono<RunCommandResult> runCommandAsync(String groupName, String name, RunCommandInput inputCommand)

Run commands in a virtual machine asynchronously.

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

Run shell script in a virtual machine.

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

Run shell script in a virtual machine asynchronously.

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

Run shell script in a virtual machine.

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

Run shell script in a virtual machine asynchronously.

abstract VirtualMachineSizes sizes()

Gets available virtual machine sizes.

abstract void start(String groupName, String name)

Starts a virtual machine.

abstract Mono<Void> startAsync(String groupName, String name)

Starts the virtual machine asynchronously.

Method Details

beginDeleteById

public abstract Accepted beginDeleteById(String id)

Begins deleting a virtual machine from Azure, identifying it by its resource ID.

Parameters:

id - the resource ID of the virtual machine to delete

Returns:

the accepted deleting operation

beginDeleteById

public abstract Accepted beginDeleteById(String id, boolean forceDeletion)

Begins force deleting a virtual machine from Azure, identifying it by its resource ID.

Parameters:

id - the resource ID of the virtual machine to delete
forceDeletion - force delete without graceful shutdown

Returns:

the accepted deleting operation

beginDeleteByResourceGroup

public abstract Accepted beginDeleteByResourceGroup(String resourceGroupName, String name)

Begins deleting a virtual machine from Azure, identifying it by its name and its resource group.

Parameters:

resourceGroupName - the resource group the resource is part of
name - the virtual machine name

Returns:

the accepted deleting operation

beginDeleteByResourceGroup

public abstract Accepted beginDeleteByResourceGroup(String resourceGroupName, String name, boolean forceDeletion)

Begins force deleting a virtual machine from Azure, identifying it by its name and its resource group.

Parameters:

resourceGroupName - the resource group the resource is part of
name - the virtual machine name
forceDeletion - force delete without graceful shutdown

Returns:

the accepted deleting operation

capture

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

Captures the virtual machine by copying virtual hard disks of the VM and returns template as a JSON string that can be used to create similar VMs.

Parameters:

groupName - the resource group name
name - the virtual machine name
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 template as JSON string

captureAsync

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

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

Parameters:

groupName - the resource group name
name - the virtual machine name
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

deallocate

public abstract void deallocate(String groupName, String name)

Shuts down the virtual machine and releases the compute resources.

Parameters:

groupName - the name of the resource group the virtual machine is in
name - the virtual machine name

deallocate

public abstract void deallocate(String groupName, String name, boolean hibernate)

Shuts down the virtual machine and releases the compute resources.

Parameters:

groupName - the name of the resource group the virtual machine is in
name - the virtual machine name
hibernate - hibernate the virtual machine

deallocateAsync

public abstract Mono deallocateAsync(String groupName, String name)

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

Parameters:

groupName - the name of the resource group the virtual machine is in
name - the virtual machine name

Returns:

a representation of the deferred computation of this call

deallocateAsync

public abstract Mono deallocateAsync(String groupName, String name, boolean hibernate)

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

Parameters:

groupName - the name of the resource group the virtual machine is in
name - the virtual machine name
hibernate - hibernate the virtual machine

Returns:

a representation of the deferred computation of this call

deleteById

public abstract void deleteById(String id, boolean forceDeletion)

Force delete a resource from Azure, identifying it by its resource ID.

Parameters:

id - the resource ID of the resource to delete
forceDeletion - force delete without graceful shutdown

deleteByIdAsync

public abstract Mono deleteByIdAsync(String id, boolean forceDeletion)

Asynchronously force delete a resource from Azure, identifying it by its resource ID.

Parameters:

id - the resource ID of the resource to delete
forceDeletion - force delete without graceful shutdown

Returns:

a representation of the deferred computation of this call

deleteByResourceGroup

public abstract void deleteByResourceGroup(String resourceGroupName, String name, boolean forceDeletion)

Force delete a resource from Azure, identifying it by its name and its resource group.

Parameters:

resourceGroupName - the resource group the resource is part of
name - the name of the resource
forceDeletion - force delete without graceful shutdown

deleteByResourceGroupAsync

public abstract Mono deleteByResourceGroupAsync(String resourceGroupName, String name, boolean forceDeletion)

Asynchronously force delete a resource from Azure, identifying it by its name and its resource group.

Parameters:

resourceGroupName - the resource group the resource is part of
name - the name of the resource
forceDeletion - force delete without graceful shutdown

Returns:

a representation of the deferred computation of this call

generalize

public abstract void generalize(String groupName, String name)

Generalizes the virtual machine.

Parameters:

groupName - the name of the resource group the virtual machine is in
name - the virtual machine name

generalizeAsync

public abstract Mono generalizeAsync(String groupName, String name)

Generalizes the virtual machine asynchronously.

Parameters:

groupName - the name of the resource group the virtual machine is in
name - the virtual machine name

Returns:

a representation of the deferred computation of this call

listByVirtualMachineScaleSet

public abstract PagedIterable listByVirtualMachineScaleSet(VirtualMachineScaleSet vmss)

Lists all the virtual machines by a certain virtual machine scale set with orchestration mode FLEXIBLE.

Note: This method is for FLEXIBLE virtual machine scale set. For UNIFORM scale sets, use virtualMachines().

Parameters:

vmss - virtual machine scale set

Returns:

A PagedIterable<T> of virtual machines

listByVirtualMachineScaleSetAsync

public abstract PagedFlux listByVirtualMachineScaleSetAsync(VirtualMachineScaleSet vmss)

Lists all the virtual machines by a certain virtual machine scale set with orchestration mode FLEXIBLE.

Note: This method is for FLEXIBLE virtual machine scale set. For UNIFORM scale sets, use virtualMachines().

Parameters:

vmss - virtual machine scale set

Returns:

A PagedFlux<T> of virtual machines

listByVirtualMachineScaleSetId

public abstract PagedIterable listByVirtualMachineScaleSetId(String vmssId)

Lists all the virtual machines by a certain virtual machine scale set with orchestration mode FLEXIBLE.

Note: This method is for FLEXIBLE virtual machine scale set. For UNIFORM scale sets, use virtualMachines().

Parameters:

vmssId - resource ID of the virtual machine scale set

Returns:

A PagedIterable<T> of virtual machines

listByVirtualMachineScaleSetIdAsync

public abstract PagedFlux listByVirtualMachineScaleSetIdAsync(String vmssId)

Lists all the virtual machines by a certain virtual machine scale set with orchestration mode FLEXIBLE.

Note: This method is for FLEXIBLE virtual machine scale set. For UNIFORM scale sets, use virtualMachines().

Parameters:

vmssId - resource ID of the virtual machine scale set

Returns:

A PagedFlux<T> of virtual machines

migrateToManaged

public abstract void migrateToManaged(String groupName, String name)

Migrates the virtual machine with unmanaged disks to use managed disks.

Parameters:

groupName - the resource group name
name - the virtual machine name

migrateToManagedAsync

public abstract Mono migrateToManagedAsync(String groupName, String name)

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

Parameters:

groupName - the resource group name
name - the virtual machine name

Returns:

a representation of the deferred computation of this call

powerOff

public abstract void powerOff(String groupName, String name)

Powers off (stops) a virtual machine.

Parameters:

groupName - the name of the resource group the virtual machine is in
name - the virtual machine name

powerOffAsync

public abstract Mono powerOffAsync(String groupName, String name)

Powers off (stops) the virtual machine asynchronously.

Parameters:

groupName - the name of the resource group the virtual machine is in
name - the virtual machine name

Returns:

a representation of the deferred computation of this call

redeploy

public abstract void redeploy(String groupName, String name)

Redeploys a virtual machine.

Parameters:

groupName - the name of the resource group the virtual machine is in
name - the virtual machine name

redeployAsync

public abstract Mono redeployAsync(String groupName, String name)

Redeploys the virtual machine asynchronously.

Parameters:

groupName - the name of the resource group the virtual machine is in
name - the virtual machine name

Returns:

a representation of the deferred computation of this call

restart

public abstract void restart(String groupName, String name)

Restarts a virtual machine.

Parameters:

groupName - the name of the resource group the virtual machine is in
name - the virtual machine name

restartAsync

public abstract Mono restartAsync(String groupName, String name)

Restarts the virtual machine asynchronously.

Parameters:

groupName - the name of the resource group the virtual machine is in
name - the virtual machine name

Returns:

a representation of the deferred computation of this call

runCommand

public abstract RunCommandResult runCommand(String groupName, String name, RunCommandInput inputCommand)

Run commands in a virtual machine.

Parameters:

groupName - the resource group name
name - the virtual machine name
inputCommand - command input

Returns:

result of execution

runCommandAsync

public abstract Mono runCommandAsync(String groupName, String name, RunCommandInput inputCommand)

Run commands in a virtual machine asynchronously.

Parameters:

groupName - the resource group name
name - the virtual machine name
inputCommand - command input

Returns:

handle to the asynchronous execution

runPowerShellScript

public abstract RunCommandResult runPowerShellScript(String groupName, String name, List scriptLines, List scriptParameters)

Run shell script in a virtual machine.

Parameters:

groupName - the resource group name
name - the virtual machine name
scriptLines - PowerShell script lines
scriptParameters - script parameters

Returns:

result of PowerShell script execution

runPowerShellScriptAsync

public abstract Mono runPowerShellScriptAsync(String groupName, String name, List scriptLines, List scriptParameters)

Run shell script in a virtual machine asynchronously.

Parameters:

groupName - the resource group name
name - the virtual machine name
scriptLines - PowerShell script lines
scriptParameters - script parameters

Returns:

handle to the asynchronous execution

runShellScript

public abstract RunCommandResult runShellScript(String groupName, String name, List scriptLines, List scriptParameters)

Run shell script in a virtual machine.

Parameters:

groupName - the resource group name
name - the virtual machine name
scriptLines - shell script lines
scriptParameters - script parameters

Returns:

result of shell script execution

runShellScriptAsync

public abstract Mono runShellScriptAsync(String groupName, String name, List scriptLines, List scriptParameters)

Run shell script in a virtual machine asynchronously.

Parameters:

groupName - the resource group name
name - the virtual machine name
scriptLines - shell script lines
scriptParameters - script parameters

Returns:

handle to the asynchronous execution

sizes

public abstract VirtualMachineSizes sizes()

Gets available virtual machine sizes.

Returns:

available virtual machine sizes

start

public abstract void start(String groupName, String name)

Starts a virtual machine.

Parameters:

groupName - the name of the resource group the virtual machine is in
name - the virtual machine name

startAsync

public abstract Mono startAsync(String groupName, String name)

Starts the virtual machine asynchronously.

Parameters:

groupName - the name of the resource group the virtual machine is in
name - the virtual machine name

Returns:

a representation of the deferred computation of this call

Applies to