pycloudlib.azure.instance module
Azure instance.
- class pycloudlib.azure.instance.AzureInstance(key_pair, client, instance, network_client, *, username: str | None = None, get_boot_diagnostics: bool = False, status: VMInstanceStatus = VMInstanceStatus.ACTIVE)[source]
Bases:
BaseInstanceAzure backed instance.
- __init__(key_pair, client, instance, network_client, *, username: str | None = None, get_boot_diagnostics: bool = False, status: VMInstanceStatus = VMInstanceStatus.ACTIVE)[source]
Set up instance.
- Parameters:
key_pair – SSH key object
client – Azure compute management client
instance – created azure instance object
username – username to use when connecting via SSH
- add_network_interface(**kwargs) str[source]
Add network interface to instance.
Creates NIC and adds to the VM instance.
NOTE: It will deallocate the virtual machine, add the NIC, then start the virtual machine.
Returns the private ip address of the new NIC.
- property id
Return instance id.
- property image_id
Return the image_id from which this instance was created.
- property ip
Return IP address of instance.
- property location: str
Return instance location.
- property name
Return instance name.
- property offer
Return instance sku.
- remove_network_interface(ip_address: str)[source]
Remove nic from running instance.
Args: ip_address: private ip address of the NIC
- shutdown(wait=True, **kwargs)[source]
Shutdown the instance.
- Parameters:
wait – wait for the instance shutdown
- property sku
Return instance sku.
- property status: VMInstanceStatus
Return VM instance status.