Ready to implement network routes contents
This commit is contained in:
@ -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
|
||||
*/
|
||||
|
@ -10,11 +10,13 @@ export interface ServerConfig {
|
||||
|
||||
export interface ServerConstraints {
|
||||
iso_max_size: number;
|
||||
name_size: LenConstraint;
|
||||
title_size: LenConstraint;
|
||||
vm_name_size: LenConstraint;
|
||||
vm_title_size: LenConstraint;
|
||||
memory_size: LenConstraint;
|
||||
disk_name_size: LenConstraint;
|
||||
disk_size: LenConstraint;
|
||||
net_name_size: LenConstraint;
|
||||
net_title_size: LenConstraint;
|
||||
}
|
||||
|
||||
export interface LenConstraint {
|
||||
|
Reference in New Issue
Block a user