Skip to main content

ComputeClient

Struct ComputeClient 

Source
pub struct ComputeClient<'a> { /* private fields */ }
Expand description

Client for the Azure Compute API.

Wraps the raw ComputeOps with ergonomic signatures that auto-inject subscription_id from the parent AzureHttpClient.

Implementations§

Source§

impl<'a> ComputeClient<'a>

Source

pub async fn list_vms( &self, resource_group_name: &str, ) -> Result<VirtualMachineListResult>

List virtual machines in a resource group.

Source

pub async fn get_vm( &self, resource_group_name: &str, vm_name: &str, ) -> Result<VirtualMachine>

Get a virtual machine.

Source

pub async fn get_vm_expanded( &self, resource_group_name: &str, vm_name: &str, expand: &str, ) -> Result<VirtualMachine>

Get a virtual machine with expanded properties.

Source

pub async fn create_vm( &self, resource_group_name: &str, vm_name: &str, body: &VirtualMachineCreateRequest, ) -> Result<VirtualMachine>

Create or update a virtual machine.

Source

pub async fn delete_vm( &self, resource_group_name: &str, vm_name: &str, ) -> Result<()>

Delete a virtual machine.

Source

pub async fn start_vm( &self, resource_group_name: &str, vm_name: &str, ) -> Result<()>

Start a virtual machine.

Source

pub async fn stop_vm( &self, resource_group_name: &str, vm_name: &str, ) -> Result<()>

Power off (stop) a virtual machine. The VM continues to be billed.

Source

pub async fn deallocate_vm( &self, resource_group_name: &str, vm_name: &str, ) -> Result<()>

Deallocate a virtual machine. Stops billing.

Source

pub async fn restart_vm( &self, resource_group_name: &str, vm_name: &str, ) -> Result<()>

Restart a virtual machine.

Source

pub async fn get_instance_view( &self, resource_group_name: &str, vm_name: &str, ) -> Result<VirtualMachineInstanceViewResult>

Get the instance view of a virtual machine.

Source

pub async fn list_vmss( &self, resource_group_name: &str, ) -> Result<VirtualMachineScaleSetListResult>

List virtual machine scale sets in a resource group.

Source

pub async fn get_vmss( &self, resource_group_name: &str, vmss_name: &str, ) -> Result<VirtualMachineScaleSet>

Get a virtual machine scale set.

Source

pub async fn create_vmss( &self, resource_group_name: &str, vmss_name: &str, body: &VirtualMachineScaleSetCreateRequest, ) -> Result<VirtualMachineScaleSet>

Create or update a virtual machine scale set.

Source

pub async fn delete_vmss( &self, resource_group_name: &str, vmss_name: &str, ) -> Result<()>

Delete a virtual machine scale set.

Source

pub async fn list_vmss_instances( &self, resource_group_name: &str, vmss_name: &str, ) -> Result<VirtualMachineScaleSetVMListResult>

List virtual machines in a VM scale set.

Source

pub async fn start_vmss_instances( &self, resource_group_name: &str, vmss_name: &str, instance_ids: &VirtualMachineScaleSetVMInstanceIDs, ) -> Result<()>

Start one or more virtual machines in a VM scale set.

Source

pub async fn stop_vmss_instances( &self, resource_group_name: &str, vmss_name: &str, instance_ids: &VirtualMachineScaleSetVMInstanceIDs, ) -> Result<()>

Power off one or more virtual machines in a VM scale set.

Source

pub async fn list_disks( &self, resource_group_name: &str, ) -> Result<DiskListResult>

List all managed disks in a resource group.

Source

pub async fn list_disks_in_subscription(&self) -> Result<DiskListResult>

List all managed disks in the subscription.

Source

pub async fn get_disk( &self, resource_group_name: &str, disk_name: &str, ) -> Result<Disk>

Get information about a managed disk.

Source

pub async fn create_disk( &self, resource_group_name: &str, disk_name: &str, body: &DiskCreateRequest, ) -> Result<Disk>

Create or update a managed disk.

Source

pub async fn delete_disk( &self, resource_group_name: &str, disk_name: &str, ) -> Result<()>

Delete a managed disk.

Source

pub async fn update_disk_sku( &self, resource_group_name: &str, disk_name: &str, sku_name: &str, ) -> Result<Disk>

Change the SKU (performance tier) of a managed disk.

The disk must be unattached OR the attached VM must be fully deallocated before this call will succeed. Returns an error if the VM is still running.

§Arguments
  • resource_group_name - Resource group containing the disk
  • disk_name - Name of the disk to update
  • sku_name - Target SKU name: “StandardSSD_LRS”, “StandardSSD_ZRS”, “Standard_LRS”, “Premium_LRS”, “Premium_ZRS”
Source

pub async fn delete_snapshot( &self, subscription_id: &str, resource_group_name: &str, snapshot_name: &str, ) -> Result<()>

Delete a managed disk snapshot.

Source

pub async fn grant_access( &self, resource_group_name: &str, disk_name: &str, body: &GrantAccessData, ) -> Result<AccessUri>

Grant SAS access to a managed disk.

The Azure beginGetAccess endpoint returns HTTP 202 with a Location header pointing to an async operation URL. This method polls that URL until the operation completes and returns the SAS URI.

Source

pub async fn revoke_access( &self, resource_group_name: &str, disk_name: &str, ) -> Result<()>

Revoke SAS access to a managed disk.

Auto Trait Implementations§

§

impl<'a> Freeze for ComputeClient<'a>

§

impl<'a> !RefUnwindSafe for ComputeClient<'a>

§

impl<'a> Send for ComputeClient<'a>

§

impl<'a> Sync for ComputeClient<'a>

§

impl<'a> Unpin for ComputeClient<'a>

§

impl<'a> UnsafeUnpin for ComputeClient<'a>

§

impl<'a> !UnwindSafe for ComputeClient<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more