use proxmox 0.1.25, use new EnumEntry feature
This commit is contained in:
@ -5,7 +5,7 @@ use proxmox::api::{api, Router, RpcEnvironment, Permission};
|
||||
|
||||
use crate::api2::types::*;
|
||||
use crate::config::acl;
|
||||
use crate::config::acl::{PRIV_SYS_AUDIT, PRIV_SYS_MODIFY};
|
||||
use crate::config::acl::{Role, PRIV_SYS_AUDIT, PRIV_SYS_MODIFY};
|
||||
|
||||
#[api(
|
||||
properties: {
|
||||
@ -23,7 +23,7 @@ use crate::config::acl::{PRIV_SYS_AUDIT, PRIV_SYS_MODIFY};
|
||||
description: "User or Group ID.",
|
||||
},
|
||||
roleid: {
|
||||
schema: ACL_ROLE_SCHEMA,
|
||||
type: Role,
|
||||
}
|
||||
}
|
||||
)]
|
||||
@ -118,7 +118,7 @@ pub fn read_acl(
|
||||
schema: ACL_PATH_SCHEMA,
|
||||
},
|
||||
role: {
|
||||
schema: ACL_ROLE_SCHEMA,
|
||||
type: Role,
|
||||
},
|
||||
propagate: {
|
||||
optional: true,
|
||||
|
@ -6,7 +6,7 @@ use proxmox::api::{api, Permission};
|
||||
use proxmox::api::router::Router;
|
||||
|
||||
use crate::api2::types::*;
|
||||
use crate::config::acl::ROLE_NAMES;
|
||||
use crate::config::acl::{Role, ROLE_NAMES};
|
||||
|
||||
#[api(
|
||||
returns: {
|
||||
@ -17,7 +17,7 @@ use crate::config::acl::ROLE_NAMES;
|
||||
description: "User name with description.",
|
||||
properties: {
|
||||
role: {
|
||||
schema: ACL_ROLE_SCHEMA,
|
||||
type: Role,
|
||||
},
|
||||
comment: {
|
||||
schema: SINGLE_LINE_COMMENT_SCHEMA,
|
||||
|
@ -31,15 +31,9 @@ pub const API_METHOD_UPGRADE_BACKUP: ApiMethod = ApiMethod::new(
|
||||
concat!("Upgraded to backup protocol ('", PROXMOX_BACKUP_READER_PROTOCOL_ID_V1!(), "')."),
|
||||
&sorted!([
|
||||
("store", false, &DATASTORE_SCHEMA),
|
||||
("backup-type", false, &StringSchema::new("Backup type.")
|
||||
.format(&ApiStringFormat::Enum(&["vm", "ct", "host"]))
|
||||
.schema()
|
||||
),
|
||||
("backup-id", false, &StringSchema::new("Backup ID.").schema()),
|
||||
("backup-time", false, &IntegerSchema::new("Backup time (Unix epoch.)")
|
||||
.minimum(1_547_797_308)
|
||||
.schema()
|
||||
),
|
||||
("backup-type", false, &BACKUP_TYPE_SCHEMA),
|
||||
("backup-id", false, &BACKUP_ID_SCHEMA),
|
||||
("backup-time", false, &BACKUP_TIME_SCHEMA),
|
||||
("debug", true, &BooleanSchema::new("Enable verbose debug logging.").schema()),
|
||||
]),
|
||||
)
|
||||
|
@ -248,24 +248,9 @@ pub const ACL_PROPAGATE_SCHEMA: Schema = BooleanSchema::new(
|
||||
|
||||
pub const ACL_UGID_TYPE_SCHEMA: Schema = StringSchema::new(
|
||||
"Type of 'ugid' property.")
|
||||
.format(&ApiStringFormat::Enum(&["user", "group"]))
|
||||
.schema();
|
||||
|
||||
pub const ACL_ROLE_SCHEMA: Schema = StringSchema::new(
|
||||
"Role.")
|
||||
.format(&ApiStringFormat::Enum(&[
|
||||
"Admin",
|
||||
"Audit",
|
||||
"Datastore.Admin",
|
||||
"Datastore.Reader",
|
||||
"Datastore.Audit",
|
||||
"Datastore.Backup",
|
||||
"Datastore.PowerUser",
|
||||
"Remote.Admin",
|
||||
"Remote.Audit",
|
||||
"Remote.SyncOperator",
|
||||
"NoAccess",
|
||||
]))
|
||||
EnumEntry::new("user", "User"),
|
||||
EnumEntry::new("group", "Group")]))
|
||||
.schema();
|
||||
|
||||
pub const BACKUP_ARCHIVE_NAME_SCHEMA: Schema =
|
||||
@ -275,7 +260,10 @@ pub const BACKUP_ARCHIVE_NAME_SCHEMA: Schema =
|
||||
|
||||
pub const BACKUP_TYPE_SCHEMA: Schema =
|
||||
StringSchema::new("Backup type.")
|
||||
.format(&ApiStringFormat::Enum(&["vm", "ct", "host"]))
|
||||
.format(&ApiStringFormat::Enum(&[
|
||||
EnumEntry::new("vm", "Virtual Machine Backup"),
|
||||
EnumEntry::new("ct", "Container Backup"),
|
||||
EnumEntry::new("host", "Host Backup")]))
|
||||
.schema();
|
||||
|
||||
pub const BACKUP_ID_SCHEMA: Schema =
|
||||
|
Reference in New Issue
Block a user