Can enable autostart of VMs
This commit is contained in:
@ -154,6 +154,29 @@ export class VMApi {
|
||||
return new VMInfo(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if autostart is enabled on a VM
|
||||
*/
|
||||
static async IsAutostart(vm: VMInfo): Promise<boolean> {
|
||||
return (
|
||||
await APIClient.exec({
|
||||
uri: `/vm/${vm.uuid}/autostart`,
|
||||
method: "GET",
|
||||
})
|
||||
).data.autostart;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set autostart status of a VM
|
||||
*/
|
||||
static async SetAutostart(vm: VMInfo, enabled: boolean): Promise<void> {
|
||||
await APIClient.exec({
|
||||
uri: `/vm/${vm.uuid}/autostart`,
|
||||
method: "PUT",
|
||||
jsonData: { autostart: enabled },
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the state of a VM
|
||||
*/
|
||||
|
Reference in New Issue
Block a user