Can update VM settings

This commit is contained in:
2023-10-16 19:22:15 +02:00
parent fbfe4f00c5
commit 674f9fe7ed
5 changed files with 95 additions and 10 deletions

View File

@ -63,7 +63,11 @@ export class VMInfo implements VMInfoInterface {
}
get ViewURL(): string {
return `/api/vm/${this.uuid}`;
return `/vm/${this.uuid}`;
}
get EditURL(): string {
return `/vm/${this.uuid}/edit`;
}
}
@ -93,6 +97,33 @@ export class VMApi {
).data.map((i: VMInfoInterface) => new VMInfo(i));
}
/**
* Get the information about a single VM
*/
static async GetSingle(uuid: string): Promise<VMInfo> {
const data = (
await APIClient.exec({
uri: `/vm/${uuid}`,
method: "GET",
})
).data;
return new VMInfo(data);
}
/**
* Update the information about a single VM
*/
static async UpdateSingle(vm: VMInfo): Promise<VMInfo> {
const data = (
await APIClient.exec({
uri: `/vm/${vm.uuid!}`,
method: "PUT",
jsonData: vm,
})
).data;
return new VMInfo(data);
}
/**
* Get the state of a VM
*/