Can enable autostart of VMs

This commit is contained in:
2023-10-28 17:30:27 +02:00
parent 9a15fb4f60
commit 335aec788e
10 changed files with 304 additions and 56 deletions

View File

@ -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
*/