import latitudesh_python_sdk
from latitudesh_python_sdk import Latitudesh
import os
with Latitudesh(
bearer=os.getenv("LATITUDESH_BEARER", ""),
) as latitudesh:
latitudesh.virtual_machines.create_virtual_machine_action(virtual_machine_id="vm_5LA73qkjdaJ2o", id="vm_5LA73qkjdaJ2o", type_=latitudesh_python_sdk.CreateVirtualMachineActionVirtualMachinesType.VIRTUAL_MACHINES, attributes={
"action": latitudesh_python_sdk.CreateVirtualMachineActionVirtualMachinesAction.REBOOT,
})
# Use the SDK ...{
"data": {
"id": "act_5LA73qkjdaJ2o",
"type": "actions",
"attributes": {
"status": "Rebooting virtual machine"
}
}
}Performs a power action on a given virtual machine:
power_on - Starts the virtual machinepower_off - Stops the virtual machinereboot - Restarts the virtual machineimport latitudesh_python_sdk
from latitudesh_python_sdk import Latitudesh
import os
with Latitudesh(
bearer=os.getenv("LATITUDESH_BEARER", ""),
) as latitudesh:
latitudesh.virtual_machines.create_virtual_machine_action(virtual_machine_id="vm_5LA73qkjdaJ2o", id="vm_5LA73qkjdaJ2o", type_=latitudesh_python_sdk.CreateVirtualMachineActionVirtualMachinesType.VIRTUAL_MACHINES, attributes={
"action": latitudesh_python_sdk.CreateVirtualMachineActionVirtualMachinesAction.REBOOT,
})
# Use the SDK ...{
"data": {
"id": "act_5LA73qkjdaJ2o",
"type": "actions",
"attributes": {
"status": "Rebooting virtual machine"
}
}
}Created
Was this page helpful?