src/api2/types.rs: define NETWORK_INTERFACE_NAME_SCHEMA
This commit is contained in:
parent
c357260d09
commit
68da20bf62
@ -101,6 +101,8 @@ pub const PASSWORD_FORMAT: ApiStringFormat =
|
|||||||
pub const ACL_PATH_FORMAT: ApiStringFormat =
|
pub const ACL_PATH_FORMAT: ApiStringFormat =
|
||||||
ApiStringFormat::Pattern(&ACL_PATH_REGEX);
|
ApiStringFormat::Pattern(&ACL_PATH_REGEX);
|
||||||
|
|
||||||
|
pub const NETWORK_INTERFACE_FORMAT: ApiStringFormat =
|
||||||
|
ApiStringFormat::Pattern(&PROXMOX_SAFE_ID_REGEX);
|
||||||
|
|
||||||
pub const PASSWORD_SCHEMA: Schema = StringSchema::new("Password.")
|
pub const PASSWORD_SCHEMA: Schema = StringSchema::new("Password.")
|
||||||
.format(&PASSWORD_FORMAT)
|
.format(&PASSWORD_FORMAT)
|
||||||
@ -458,12 +460,16 @@ pub enum NetworkConfigMethod {
|
|||||||
Loopback,
|
Loopback,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub const NETWORK_INTERFACE_NAME_SCHEMA: Schema = StringSchema::new("Network interface name.")
|
||||||
|
.format(&NETWORK_INTERFACE_FORMAT)
|
||||||
|
.min_length(1)
|
||||||
|
.max_length(libc::IFNAMSIZ-1)
|
||||||
|
.schema();
|
||||||
|
|
||||||
#[api(
|
#[api(
|
||||||
properties: {
|
properties: {
|
||||||
name: {
|
name: {
|
||||||
type: String,
|
schema: NETWORK_INTERFACE_NAME_SCHEMA,
|
||||||
min_length: 1,
|
|
||||||
max_length: libc::IFNAMSIZ-1,
|
|
||||||
},
|
},
|
||||||
method_v4: {
|
method_v4: {
|
||||||
type: NetworkConfigMethod,
|
type: NetworkConfigMethod,
|
||||||
@ -477,7 +483,7 @@ pub enum NetworkConfigMethod {
|
|||||||
description: "Option list (inet)",
|
description: "Option list (inet)",
|
||||||
type: Array,
|
type: Array,
|
||||||
items: {
|
items: {
|
||||||
description: "Optional attribute.",
|
description: "Optional attribute line.",
|
||||||
type: String,
|
type: String,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -485,7 +491,7 @@ pub enum NetworkConfigMethod {
|
|||||||
description: "Option list (inet6)",
|
description: "Option list (inet6)",
|
||||||
type: Array,
|
type: Array,
|
||||||
items: {
|
items: {
|
||||||
description: "Optional attribute.",
|
description: "Optional attribute line.",
|
||||||
type: String,
|
type: String,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user