mirror of
https://git.proxmox.com/git/proxmox
synced 2025-05-23 09:40:20 +00:00
update to first proxmox crate split
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
1aaac3f173
commit
d18f79dd4f
@ -14,7 +14,11 @@ openssl = "0.10"
|
|||||||
regex = "1.2"
|
regex = "1.2"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
|
|
||||||
|
proxmox = "0.14.0"
|
||||||
|
proxmox-lang = "1.0.0"
|
||||||
proxmox-schema = { version = "1.0.0", features = [ "api-macro" ] }
|
proxmox-schema = { version = "1.0.0", features = [ "api-macro" ] }
|
||||||
|
proxmox-time = "1.0.0"
|
||||||
|
proxmox-uuid = { version = "1.0.0", features = [ "serde" ] }
|
||||||
|
|
||||||
proxmox-rrd-api-types = { path = "../proxmox-rrd-api-types" }
|
proxmox-rrd-api-types = { path = "../proxmox-rrd-api-types" }
|
||||||
proxmox-systemd = { path = "../proxmox-systemd" }
|
proxmox-systemd = { path = "../proxmox-systemd" }
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
use serde::de::{value, IntoDeserializer};
|
use serde::de::{value, IntoDeserializer};
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use proxmox::api::api;
|
use proxmox_lang::constnamedbitmap;
|
||||||
use proxmox::api::schema::{
|
use proxmox_schema::{
|
||||||
ApiStringFormat, BooleanSchema, EnumEntry, Schema, StringSchema,
|
api, const_regex, ApiStringFormat, BooleanSchema, EnumEntry, Schema, StringSchema,
|
||||||
};
|
};
|
||||||
use proxmox::{constnamedbitmap, const_regex};
|
|
||||||
|
|
||||||
const_regex! {
|
const_regex! {
|
||||||
pub ACL_PATH_REGEX = concat!(r"^(?:/|", r"(?:/", PROXMOX_SAFE_ID_REGEX_STR!(), ")+", r")$");
|
pub ACL_PATH_REGEX = concat!(r"^(?:/|", r"(?:/", PROXMOX_SAFE_ID_REGEX_STR!(), ")+", r")$");
|
||||||
@ -222,7 +221,6 @@ pub enum Role {
|
|||||||
TapeReader = ROLE_TAPE_READER,
|
TapeReader = ROLE_TAPE_READER,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
impl FromStr for Role {
|
impl FromStr for Role {
|
||||||
type Err = value::Error;
|
type Err = value::Error;
|
||||||
|
|
||||||
@ -231,26 +229,24 @@ impl FromStr for Role {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const ACL_PATH_FORMAT: ApiStringFormat =
|
pub const ACL_PATH_FORMAT: ApiStringFormat = ApiStringFormat::Pattern(&ACL_PATH_REGEX);
|
||||||
ApiStringFormat::Pattern(&ACL_PATH_REGEX);
|
|
||||||
|
|
||||||
pub const ACL_PATH_SCHEMA: Schema = StringSchema::new(
|
pub const ACL_PATH_SCHEMA: Schema = StringSchema::new("Access control path.")
|
||||||
"Access control path.")
|
|
||||||
.format(&ACL_PATH_FORMAT)
|
.format(&ACL_PATH_FORMAT)
|
||||||
.min_length(1)
|
.min_length(1)
|
||||||
.max_length(128)
|
.max_length(128)
|
||||||
.schema();
|
.schema();
|
||||||
|
|
||||||
pub const ACL_PROPAGATE_SCHEMA: Schema = BooleanSchema::new(
|
pub const ACL_PROPAGATE_SCHEMA: Schema =
|
||||||
"Allow to propagate (inherit) permissions.")
|
BooleanSchema::new("Allow to propagate (inherit) permissions.")
|
||||||
.default(true)
|
.default(true)
|
||||||
.schema();
|
.schema();
|
||||||
|
|
||||||
pub const ACL_UGID_TYPE_SCHEMA: Schema = StringSchema::new(
|
pub const ACL_UGID_TYPE_SCHEMA: Schema = StringSchema::new("Type of 'ugid' property.")
|
||||||
"Type of 'ugid' property.")
|
|
||||||
.format(&ApiStringFormat::Enum(&[
|
.format(&ApiStringFormat::Enum(&[
|
||||||
EnumEntry::new("user", "User"),
|
EnumEntry::new("user", "User"),
|
||||||
EnumEntry::new("group", "Group")]))
|
EnumEntry::new("group", "Group"),
|
||||||
|
]))
|
||||||
.schema();
|
.schema();
|
||||||
|
|
||||||
#[api(
|
#[api(
|
||||||
|
@ -3,7 +3,7 @@ use std::fmt::{self, Display};
|
|||||||
use anyhow::Error;
|
use anyhow::Error;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use proxmox::api::api;
|
use proxmox_schema::api;
|
||||||
|
|
||||||
use pbs_tools::format::{as_fingerprint, bytes_as_fingerprint};
|
use pbs_tools::format::{as_fingerprint, bytes_as_fingerprint};
|
||||||
|
|
||||||
|
@ -1,13 +1,10 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use proxmox::api::api;
|
use proxmox_schema::{
|
||||||
use proxmox::api::schema::{
|
api, const_regex, ApiStringFormat, ApiType, ArraySchema, EnumEntry, IntegerSchema, ReturnType,
|
||||||
ApiStringFormat, ApiType, ArraySchema, EnumEntry, IntegerSchema, ReturnType, Schema,
|
Schema, StringSchema, Updater,
|
||||||
StringSchema, Updater,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use proxmox::const_regex;
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
PROXMOX_SAFE_ID_FORMAT, SHA256_HEX_REGEX, SINGLE_LINE_COMMENT_SCHEMA, CryptMode, UPID,
|
PROXMOX_SAFE_ID_FORMAT, SHA256_HEX_REGEX, SINGLE_LINE_COMMENT_SCHEMA, CryptMode, UPID,
|
||||||
Fingerprint, Userid, Authid,
|
Fingerprint, Userid, Authid,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use proxmox::api::api;
|
use proxmox_schema::api;
|
||||||
|
|
||||||
#[api]
|
#[api]
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use proxmox::const_regex;
|
use proxmox_schema::*;
|
||||||
|
|
||||||
use proxmox::api::{api, schema::*};
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
Userid, Authid, REMOTE_ID_SCHEMA, DRIVE_NAME_SCHEMA, MEDIA_POOL_NAME_SCHEMA,
|
Userid, Authid, REMOTE_ID_SCHEMA, DRIVE_NAME_SCHEMA, MEDIA_POOL_NAME_SCHEMA,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use proxmox::api::api;
|
use proxmox_schema::api;
|
||||||
|
|
||||||
use crate::CERT_FINGERPRINT_SHA256_SCHEMA;
|
use crate::CERT_FINGERPRINT_SHA256_SCHEMA;
|
||||||
|
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use anyhow::bail;
|
use anyhow::bail;
|
||||||
|
|
||||||
use proxmox::api::api;
|
use proxmox_schema::{
|
||||||
use proxmox::api::schema::{ApiStringFormat, ApiType, ArraySchema, Schema, StringSchema, ReturnType};
|
api, const_regex, ApiStringFormat, ApiType, ArraySchema, Schema, StringSchema, ReturnType,
|
||||||
use proxmox::const_regex;
|
};
|
||||||
use proxmox::{IPRE, IPRE_BRACKET, IPV4OCTET, IPV4RE, IPV6H16, IPV6LS32, IPV6RE};
|
use proxmox::{IPRE, IPRE_BRACKET, IPV4OCTET, IPV4RE, IPV6H16, IPV6LS32, IPV6RE};
|
||||||
|
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
@ -60,7 +60,7 @@ pub use userid::{PROXMOX_GROUP_ID_SCHEMA, PROXMOX_TOKEN_ID_SCHEMA, PROXMOX_TOKEN
|
|||||||
mod user;
|
mod user;
|
||||||
pub use user::*;
|
pub use user::*;
|
||||||
|
|
||||||
pub use proxmox::api::upid::*;
|
pub use proxmox_schema::upid::*;
|
||||||
|
|
||||||
mod crypto;
|
mod crypto;
|
||||||
pub use crypto::{CryptMode, Fingerprint};
|
pub use crypto::{CryptMode, Fingerprint};
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use proxmox::api::{api, schema::*};
|
use proxmox_schema::*;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
PROXMOX_SAFE_ID_REGEX,
|
PROXMOX_SAFE_ID_REGEX,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use proxmox::api::{api, schema::*};
|
use proxmox_schema::*;
|
||||||
|
|
||||||
pub const REMOTE_PASSWORD_SCHEMA: Schema = StringSchema::new("Password or auth token for remote host.")
|
pub const REMOTE_PASSWORD_SCHEMA: Schema = StringSchema::new("Password or auth token for remote host.")
|
||||||
.format(&PASSWORD_FORMAT)
|
.format(&PASSWORD_FORMAT)
|
||||||
|
@ -2,22 +2,11 @@
|
|||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use proxmox::api::{
|
use proxmox_schema::{
|
||||||
api,
|
api, ApiStringFormat, ArraySchema, IntegerSchema, Schema, StringSchema, Updater,
|
||||||
schema::{
|
|
||||||
Schema,
|
|
||||||
ApiStringFormat,
|
|
||||||
ArraySchema,
|
|
||||||
IntegerSchema,
|
|
||||||
StringSchema,
|
|
||||||
Updater,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{OptionalDeviceIdentification, PROXMOX_SAFE_ID_FORMAT};
|
||||||
PROXMOX_SAFE_ID_FORMAT,
|
|
||||||
OptionalDeviceIdentification,
|
|
||||||
};
|
|
||||||
|
|
||||||
pub const CHANGER_NAME_SCHEMA: Schema = StringSchema::new("Tape Changer Identifier.")
|
pub const CHANGER_NAME_SCHEMA: Schema = StringSchema::new("Tape Changer Identifier.")
|
||||||
.format(&PROXMOX_SAFE_ID_FORMAT)
|
.format(&PROXMOX_SAFE_ID_FORMAT)
|
||||||
@ -25,9 +14,8 @@ pub const CHANGER_NAME_SCHEMA: Schema = StringSchema::new("Tape Changer Identifi
|
|||||||
.max_length(32)
|
.max_length(32)
|
||||||
.schema();
|
.schema();
|
||||||
|
|
||||||
pub const SCSI_CHANGER_PATH_SCHEMA: Schema = StringSchema::new(
|
pub const SCSI_CHANGER_PATH_SCHEMA: Schema =
|
||||||
"Path to Linux generic SCSI device (e.g. '/dev/sg4')")
|
StringSchema::new("Path to Linux generic SCSI device (e.g. '/dev/sg4')").schema();
|
||||||
.schema();
|
|
||||||
|
|
||||||
pub const MEDIA_LABEL_SCHEMA: Schema = StringSchema::new("Media Label/Barcode.")
|
pub const MEDIA_LABEL_SCHEMA: Schema = StringSchema::new("Media Label/Barcode.")
|
||||||
.format(&PROXMOX_SAFE_ID_FORMAT)
|
.format(&PROXMOX_SAFE_ID_FORMAT)
|
||||||
@ -36,16 +24,18 @@ pub const MEDIA_LABEL_SCHEMA: Schema = StringSchema::new("Media Label/Barcode.")
|
|||||||
.schema();
|
.schema();
|
||||||
|
|
||||||
pub const SLOT_ARRAY_SCHEMA: Schema = ArraySchema::new(
|
pub const SLOT_ARRAY_SCHEMA: Schema = ArraySchema::new(
|
||||||
"Slot list.", &IntegerSchema::new("Slot number")
|
"Slot list.",
|
||||||
.minimum(1)
|
&IntegerSchema::new("Slot number").minimum(1).schema(),
|
||||||
.schema())
|
)
|
||||||
.schema();
|
.schema();
|
||||||
|
|
||||||
pub const EXPORT_SLOT_LIST_SCHEMA: Schema = StringSchema::new("\
|
pub const EXPORT_SLOT_LIST_SCHEMA: Schema = StringSchema::new(
|
||||||
|
"\
|
||||||
A list of slot numbers, comma separated. Those slots are reserved for
|
A list of slot numbers, comma separated. Those slots are reserved for
|
||||||
Import/Export, i.e. any media in those slots are considered to be
|
Import/Export, i.e. any media in those slots are considered to be
|
||||||
'offline'.
|
'offline'.
|
||||||
")
|
",
|
||||||
|
)
|
||||||
.format(&ApiStringFormat::PropertyString(&SLOT_ARRAY_SCHEMA))
|
.format(&ApiStringFormat::PropertyString(&SLOT_ARRAY_SCHEMA))
|
||||||
.schema();
|
.schema();
|
||||||
|
|
||||||
@ -63,14 +53,14 @@ Import/Export, i.e. any media in those slots are considered to be
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
)]
|
)]
|
||||||
#[derive(Serialize,Deserialize,Updater)]
|
#[derive(Serialize, Deserialize, Updater)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "kebab-case")]
|
||||||
/// SCSI tape changer
|
/// SCSI tape changer
|
||||||
pub struct ScsiTapeChanger {
|
pub struct ScsiTapeChanger {
|
||||||
#[updater(skip)]
|
#[updater(skip)]
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub path: String,
|
pub path: String,
|
||||||
#[serde(skip_serializing_if="Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub export_slots: Option<String>,
|
pub export_slots: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,7 +74,7 @@ pub struct ScsiTapeChanger {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
)]
|
)]
|
||||||
#[derive(Serialize,Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "kebab-case")]
|
||||||
/// Changer config with optional device identification attributes
|
/// Changer config with optional device identification attributes
|
||||||
pub struct ChangerListEntry {
|
pub struct ChangerListEntry {
|
||||||
@ -95,7 +85,7 @@ pub struct ChangerListEntry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[api()]
|
#[api()]
|
||||||
#[derive(Serialize,Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "kebab-case")]
|
||||||
/// Mtx Entry Kind
|
/// Mtx Entry Kind
|
||||||
pub enum MtxEntryKind {
|
pub enum MtxEntryKind {
|
||||||
@ -118,7 +108,7 @@ pub enum MtxEntryKind {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
)]
|
)]
|
||||||
#[derive(Serialize,Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "kebab-case")]
|
||||||
/// Mtx Status Entry
|
/// Mtx Status Entry
|
||||||
pub struct MtxStatusEntry {
|
pub struct MtxStatusEntry {
|
||||||
@ -126,12 +116,12 @@ pub struct MtxStatusEntry {
|
|||||||
/// The ID of the slot or drive
|
/// The ID of the slot or drive
|
||||||
pub entry_id: u64,
|
pub entry_id: u64,
|
||||||
/// The media label (volume tag) if the slot/drive is full
|
/// The media label (volume tag) if the slot/drive is full
|
||||||
#[serde(skip_serializing_if="Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub label_text: Option<String>,
|
pub label_text: Option<String>,
|
||||||
/// The slot the drive was loaded from
|
/// The slot the drive was loaded from
|
||||||
#[serde(skip_serializing_if="Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub loaded_slot: Option<u64>,
|
pub loaded_slot: Option<u64>,
|
||||||
/// The current state of the drive
|
/// The current state of the drive
|
||||||
#[serde(skip_serializing_if="Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub state: Option<String>,
|
pub state: Option<String>,
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use ::serde::{Deserialize, Serialize};
|
use ::serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use proxmox::api::api;
|
use proxmox_schema::api;
|
||||||
|
|
||||||
#[api()]
|
#[api()]
|
||||||
#[derive(Serialize,Deserialize)]
|
#[derive(Serialize,Deserialize)]
|
||||||
|
@ -4,10 +4,7 @@ use std::convert::TryFrom;
|
|||||||
use anyhow::{bail, Error};
|
use anyhow::{bail, Error};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use proxmox::api::{
|
use proxmox_schema::{api, Schema, IntegerSchema, StringSchema, Updater};
|
||||||
api,
|
|
||||||
schema::{Schema, IntegerSchema, StringSchema, Updater},
|
|
||||||
};
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
PROXMOX_SAFE_ID_FORMAT,
|
PROXMOX_SAFE_ID_FORMAT,
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
use ::serde::{Deserialize, Serialize};
|
use ::serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use proxmox::{
|
use proxmox_schema::*;
|
||||||
api::{api, schema::*},
|
use proxmox_uuid::Uuid;
|
||||||
tools::Uuid,
|
|
||||||
};
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
UUID_FORMAT,
|
UUID_FORMAT,
|
||||||
|
@ -1,18 +1,8 @@
|
|||||||
use anyhow::{bail, Error};
|
use anyhow::{bail, Error};
|
||||||
|
|
||||||
use proxmox::api::{
|
use proxmox_schema::{parse_simple_value, ApiStringFormat, Schema, StringSchema};
|
||||||
schema::{
|
|
||||||
Schema,
|
|
||||||
StringSchema,
|
|
||||||
ApiStringFormat,
|
|
||||||
parse_simple_value,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{CHANGER_NAME_SCHEMA, PROXMOX_SAFE_ID_FORMAT};
|
||||||
PROXMOX_SAFE_ID_FORMAT,
|
|
||||||
CHANGER_NAME_SCHEMA,
|
|
||||||
};
|
|
||||||
|
|
||||||
pub const VAULT_NAME_SCHEMA: Schema = StringSchema::new("Vault name.")
|
pub const VAULT_NAME_SCHEMA: Schema = StringSchema::new("Vault name.")
|
||||||
.format(&PROXMOX_SAFE_ID_FORMAT)
|
.format(&PROXMOX_SAFE_ID_FORMAT)
|
||||||
@ -35,28 +25,27 @@ pub enum MediaLocation {
|
|||||||
proxmox::forward_deserialize_to_from_str!(MediaLocation);
|
proxmox::forward_deserialize_to_from_str!(MediaLocation);
|
||||||
proxmox::forward_serialize_to_display!(MediaLocation);
|
proxmox::forward_serialize_to_display!(MediaLocation);
|
||||||
|
|
||||||
impl proxmox::api::schema::ApiType for MediaLocation {
|
impl proxmox_schema::ApiType for MediaLocation {
|
||||||
const API_SCHEMA: Schema = StringSchema::new(
|
const API_SCHEMA: Schema = StringSchema::new(
|
||||||
"Media location (e.g. 'offline', 'online-<changer_name>', 'vault-<vault_name>')")
|
"Media location (e.g. 'offline', 'online-<changer_name>', 'vault-<vault_name>')",
|
||||||
.format(&ApiStringFormat::VerifyFn(|text| {
|
)
|
||||||
let location: MediaLocation = text.parse()?;
|
.format(&ApiStringFormat::VerifyFn(|text| {
|
||||||
match location {
|
let location: MediaLocation = text.parse()?;
|
||||||
MediaLocation::Online(ref changer) => {
|
match location {
|
||||||
parse_simple_value(changer, &CHANGER_NAME_SCHEMA)?;
|
MediaLocation::Online(ref changer) => {
|
||||||
}
|
parse_simple_value(changer, &CHANGER_NAME_SCHEMA)?;
|
||||||
MediaLocation::Vault(ref vault) => {
|
|
||||||
parse_simple_value(vault, &VAULT_NAME_SCHEMA)?;
|
|
||||||
}
|
|
||||||
MediaLocation::Offline => { /* OK */}
|
|
||||||
}
|
}
|
||||||
Ok(())
|
MediaLocation::Vault(ref vault) => {
|
||||||
}))
|
parse_simple_value(vault, &VAULT_NAME_SCHEMA)?;
|
||||||
.schema();
|
}
|
||||||
|
MediaLocation::Offline => { /* OK */ }
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}))
|
||||||
|
.schema();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
impl std::fmt::Display for MediaLocation {
|
impl std::fmt::Display for MediaLocation {
|
||||||
|
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
MediaLocation::Offline => {
|
MediaLocation::Offline => {
|
||||||
|
@ -9,10 +9,7 @@ use std::str::FromStr;
|
|||||||
use anyhow::Error;
|
use anyhow::Error;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use proxmox::api::{
|
use proxmox_schema::{api, Schema, StringSchema, ApiStringFormat, Updater};
|
||||||
api,
|
|
||||||
schema::{Schema, StringSchema, ApiStringFormat, Updater},
|
|
||||||
};
|
|
||||||
|
|
||||||
use proxmox_systemd::time::{parse_calendar_event, parse_time_span, CalendarEvent, TimeSpan};
|
use proxmox_systemd::time::{parse_calendar_event, parse_time_span, CalendarEvent, TimeSpan};
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use ::serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use proxmox::api::api;
|
use proxmox_schema::api;
|
||||||
|
|
||||||
#[api()]
|
#[api()]
|
||||||
/// Media status
|
/// Media status
|
||||||
|
@ -22,13 +22,10 @@ pub use media_location::*;
|
|||||||
mod media;
|
mod media;
|
||||||
pub use media::*;
|
pub use media::*;
|
||||||
|
|
||||||
use ::serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use proxmox::api::api;
|
use proxmox_schema::{api, const_regex, Schema, StringSchema, ApiStringFormat};
|
||||||
use proxmox::api::schema::{Schema, StringSchema, ApiStringFormat};
|
use proxmox_uuid::Uuid;
|
||||||
use proxmox::tools::Uuid;
|
|
||||||
|
|
||||||
use proxmox::const_regex;
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
FINGERPRINT_SHA256_FORMAT, BACKUP_ID_SCHEMA, BACKUP_TYPE_SCHEMA,
|
FINGERPRINT_SHA256_FORMAT, BACKUP_ID_SCHEMA, BACKUP_TYPE_SCHEMA,
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use proxmox::api::api;
|
use proxmox_schema::{
|
||||||
use proxmox::api::schema::{
|
api, BooleanSchema, IntegerSchema, Schema, StringSchema, Updater,
|
||||||
BooleanSchema, IntegerSchema, Schema, StringSchema, Updater,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::{SINGLE_LINE_COMMENT_FORMAT, SINGLE_LINE_COMMENT_SCHEMA};
|
use super::{SINGLE_LINE_COMMENT_FORMAT, SINGLE_LINE_COMMENT_SCHEMA};
|
||||||
@ -133,7 +132,7 @@ impl ApiToken {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if let Some(expire) = self.expire {
|
if let Some(expire) = self.expire {
|
||||||
let now = proxmox::tools::time::epoch_i64();
|
let now = proxmox_time::epoch_i64();
|
||||||
if expire > 0 && expire <= now {
|
if expire > 0 && expire <= now {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -198,7 +197,7 @@ impl User {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if let Some(expire) = self.expire {
|
if let Some(expire) = self.expire {
|
||||||
let now = proxmox::tools::time::epoch_i64();
|
let now = proxmox_time::epoch_i64();
|
||||||
if expire > 0 && expire <= now {
|
if expire > 0 && expire <= now {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -29,9 +29,9 @@ use anyhow::{bail, format_err, Error};
|
|||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use proxmox::api::api;
|
use proxmox_schema::{
|
||||||
use proxmox::api::schema::{ApiStringFormat, ApiType, Schema, StringSchema, UpdaterType};
|
api, const_regex, ApiStringFormat, ApiType, Schema, StringSchema, UpdaterType,
|
||||||
use proxmox::const_regex;
|
};
|
||||||
|
|
||||||
// we only allow a limited set of characters
|
// we only allow a limited set of characters
|
||||||
// colon is not allowed, because we store usernames in
|
// colon is not allowed, because we store usernames in
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use proxmox::api::{api, schema::*};
|
use proxmox_schema::*;
|
||||||
|
|
||||||
use proxmox::const_regex;
|
|
||||||
|
|
||||||
const_regex! {
|
const_regex! {
|
||||||
pub ZPOOL_NAME_REGEX = r"^[a-zA-Z][a-z0-9A-Z\-_.:]+$";
|
pub ZPOOL_NAME_REGEX = r"^[a-zA-Z][a-z0-9A-Z\-_.:]+$";
|
||||||
|
Loading…
Reference in New Issue
Block a user