Ready to implement network routes contents

This commit is contained in:
2023-12-04 20:16:32 +01:00
parent 0e3945089c
commit e579a3aadd
16 changed files with 523 additions and 46 deletions

View File

@ -8,7 +8,7 @@ export interface IpConfig {
export interface NetworkInfo {
name: string;
uuid: string;
uuid?: string;
title?: string;
description?: string;
forward_mode: "NAT" | "Isolated";
@ -24,6 +24,19 @@ export function NetworkURL(n: NetworkInfo, edit: boolean = false): string {
}
export class NetworkApi {
/**
* Create a new network
*/
static async Create(n: NetworkInfo): Promise<{ uid: string }> {
return (
await APIClient.exec({
method: "POST",
uri: "/network/create",
jsonData: n,
})
).data;
}
/**
* Get the entire list of networks
*/
@ -36,6 +49,31 @@ export class NetworkApi {
).data;
}
/**
* Get the information about a single network
*/
static async GetSingle(uuid: string): Promise<NetworkInfo> {
return (
await APIClient.exec({
method: "GET",
uri: `/network/${uuid}`,
})
).data;
}
/**
* Update an existing network
*/
static async Update(n: NetworkInfo): Promise<{ uid: string }> {
return (
await APIClient.exec({
method: "PUT",
uri: `/network/${n.uuid}`,
jsonData: n,
})
).data;
}
/**
* Delete a network
*/