update to first proxmox crate split

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller
2021-10-08 11:19:37 +02:00
parent e3f3359c86
commit 6ef1b649d9
265 changed files with 880 additions and 1036 deletions

View File

@ -2,7 +2,8 @@
use anyhow::{bail, Error};
use proxmox::api::{api, Router, RpcEnvironment, Permission};
use proxmox_router::{Router, RpcEnvironment, Permission};
use proxmox_schema::api;
use pbs_api_types::{
Authid, AclListItem, Role,

View File

@ -5,7 +5,8 @@ use anyhow::{Error};
use serde::{Deserialize, Serialize};
use serde_json::{json, Value};
use proxmox::api::{api, Permission, Router, RpcEnvironment};
use proxmox_router::{Router, RpcEnvironment, Permission};
use proxmox_schema::api;
use pbs_api_types::{REALM_ID_SCHEMA, SINGLE_LINE_COMMENT_SCHEMA};

View File

@ -6,10 +6,11 @@ use serde_json::{json, Value};
use std::collections::HashMap;
use std::collections::HashSet;
use proxmox::api::router::{Router, SubdirMap};
use proxmox::api::{api, Permission, RpcEnvironment};
use proxmox::{http_err, list_subdirs_api_method};
use proxmox::{identity, sortable};
use proxmox_router::{
http_err, list_subdirs_api_method, Router, RpcEnvironment, SubdirMap, Permission,
};
use proxmox_schema::api;
use pbs_api_types::{
Userid, Authid, PASSWORD_SCHEMA, ACL_PATH_SCHEMA,

View File

@ -5,9 +5,11 @@ use anyhow::{bail, format_err, Error};
use serde_json::{json, Value};
use proxmox::api::router::{Router, SubdirMap};
use proxmox::api::{api, Permission, RpcEnvironment};
use proxmox::{http_err, list_subdirs_api_method, identity, sortable};
use proxmox::{identity, sortable};
use proxmox_router::{
http_err, list_subdirs_api_method, Router, RpcEnvironment, SubdirMap, Permission,
};
use proxmox_schema::api;
use proxmox_openid::{OpenIdAuthenticator, OpenIdConfig};
@ -88,7 +90,7 @@ pub fn openid_login(
let mut tested_username = None;
let result = proxmox::try_block!({
let result = proxmox_lang::try_block!({
let (realm, private_auth_state) =
OpenIdAuthenticator::verify_public_auth_state(PROXMOX_BACKUP_RUN_DIR_M!(), &state)?;

View File

@ -4,8 +4,8 @@ use anyhow::Error;
use serde_json::{json, Value};
use proxmox::api::{api, Permission};
use proxmox::api::router::Router;
use proxmox_router::{Permission, Router};
use proxmox_schema::api;
use pbs_api_types::{Role, SINGLE_LINE_COMMENT_SCHEMA, PRIVILEGES};
use pbs_config::acl::ROLE_NAMES;

View File

@ -3,9 +3,9 @@
use anyhow::{bail, format_err, Error};
use serde::{Deserialize, Serialize};
use proxmox::api::{api, Permission, Router, RpcEnvironment};
use proxmox::tools::tfa::totp::Totp;
use proxmox::{http_bail, http_err};
use proxmox_router::{http_bail, http_err, Router, RpcEnvironment, Permission};
use proxmox_schema::api;
use proxmox_tfa::totp::Totp;
use pbs_api_types::{Authid, Userid, User, PASSWORD_SCHEMA, PRIV_PERMISSIONS_MODIFY, PRIV_SYS_AUDIT};

View File

@ -5,8 +5,8 @@ use serde::{Serialize, Deserialize};
use serde_json::{json, Value};
use std::collections::HashMap;
use proxmox::api::{api, ApiMethod, Router, RpcEnvironment, Permission};
use proxmox::api::router::SubdirMap;
use proxmox_router::{ApiMethod, Router, RpcEnvironment, SubdirMap, Permission};
use proxmox_schema::api;
use pbs_api_types::{
PROXMOX_CONFIG_DIGEST_SCHEMA, SINGLE_LINE_COMMENT_SCHEMA, Authid,
@ -498,7 +498,7 @@ pub fn generate_token(
bail!("token '{}' for user '{}' already exists.", token_name.as_str(), userid);
}
let secret = format!("{:x}", proxmox::tools::uuid::Uuid::generate());
let secret = format!("{:x}", proxmox_uuid::Uuid::generate());
token_shadow::set_secret(&tokenid, &secret)?;
let token = ApiToken {

View File

@ -12,16 +12,15 @@ use hyper::{header, Body, Response, StatusCode};
use serde_json::{json, Value};
use tokio_stream::wrappers::ReceiverStream;
use proxmox::api::{
api, ApiResponseFuture, ApiHandler, ApiMethod, Router,
RpcEnvironment, RpcEnvironmentType, Permission
};
use proxmox::api::router::SubdirMap;
use proxmox::api::schema::*;
use proxmox::{identity, sortable};
use proxmox::tools::fs::{
file_read_firstline, file_read_optional_string, replace_file, CreateOptions,
};
use proxmox::{http_err, identity, list_subdirs_api_method, sortable};
use proxmox_router::{
list_subdirs_api_method, http_err, ApiResponseFuture, ApiHandler, ApiMethod, Router,
RpcEnvironment, RpcEnvironmentType, SubdirMap, Permission,
};
use proxmox_schema::*;
use pxar::accessor::aio::Accessor;
use pxar::EntryKind;

View File

@ -1,7 +1,7 @@
//! Backup Server Administration
use proxmox::api::router::{Router, SubdirMap};
use proxmox::list_subdirs_api_method;
use proxmox_router::{Router, SubdirMap};
use proxmox_router::list_subdirs_api_method;
pub mod datastore;
pub mod sync;

View File

@ -3,9 +3,12 @@
use anyhow::{bail, format_err, Error};
use serde_json::Value;
use proxmox::api::{api, ApiMethod, Permission, Router, RpcEnvironment, RpcEnvironmentType};
use proxmox::api::router::SubdirMap;
use proxmox::{list_subdirs_api_method, sortable};
use proxmox::sortable;
use proxmox_router::{
list_subdirs_api_method, ApiMethod, Router, RpcEnvironment, RpcEnvironmentType, SubdirMap,
Permission,
};
use proxmox_schema::api;
use pbs_api_types::{DATASTORE_SCHEMA, JOB_ID_SCHEMA, Authid, SyncJobConfig, SyncJobStatus};
use pbs_config::sync;

View File

@ -3,9 +3,12 @@
use anyhow::{format_err, Error};
use serde_json::Value;
use proxmox::api::router::SubdirMap;
use proxmox::{list_subdirs_api_method, sortable};
use proxmox::api::{api, ApiMethod, Permission, Router, RpcEnvironment, RpcEnvironmentType};
use proxmox::sortable;
use proxmox_router::{
list_subdirs_api_method, ApiMethod, Router, RpcEnvironment, RpcEnvironmentType, SubdirMap,
Permission,
};
use proxmox_schema::api;
use pbs_api_types::{
VerificationJobConfig, VerificationJobStatus, JOB_ID_SCHEMA, Authid,

View File

@ -8,7 +8,7 @@ use serde_json::{json, Value};
use proxmox::tools::digest_to_hex;
use proxmox::tools::fs::{replace_file, CreateOptions};
use proxmox::api::{RpcEnvironment, RpcEnvironmentType};
use proxmox_router::{RpcEnvironment, RpcEnvironmentType};
use pbs_datastore::{DataStore, DataBlob};
use pbs_datastore::backup_info::{BackupDir, BackupInfo};

View File

@ -7,10 +7,12 @@ use hyper::http::request::Parts;
use hyper::{Body, Response, Request, StatusCode};
use serde_json::{json, Value};
use proxmox::{sortable, identity, list_subdirs_api_method};
use proxmox::api::{ApiResponseFuture, ApiHandler, ApiMethod, Router, RpcEnvironment, Permission};
use proxmox::api::router::SubdirMap;
use proxmox::api::schema::*;
use proxmox::{sortable, identity};
use proxmox_router::list_subdirs_api_method;
use proxmox_router::{
ApiResponseFuture, ApiHandler, ApiMethod, Router, RpcEnvironment, SubdirMap, Permission,
};
use proxmox_schema::*;
use pbs_api_types::{
Authid, VerifyState, SnapshotVerifyState,

View File

@ -9,8 +9,8 @@ use hyper::http::request::Parts;
use serde_json::{json, Value};
use proxmox::{sortable, identity};
use proxmox::api::{ApiResponseFuture, ApiHandler, ApiMethod, RpcEnvironment};
use proxmox::api::schema::*;
use proxmox_router::{ApiResponseFuture, ApiHandler, ApiMethod, RpcEnvironment};
use proxmox_schema::*;
use pbs_datastore::{DataStore, DataBlob};
use pbs_datastore::file_formats::{DataBlobHeader, EncryptedDataBlobHeader};
@ -59,7 +59,7 @@ impl Future for UploadChunk {
break format_err!("uploaded chunk has unexpected size.");
}
let (is_duplicate, compressed_size) = match proxmox::try_block! {
let (is_duplicate, compressed_size) = match proxmox_lang::try_block! {
let mut chunk = DataBlob::from_raw(raw_data)?;
pbs_runtime::block_in_place(|| {

View File

@ -1,5 +1,5 @@
use proxmox::api::{Router, SubdirMap};
use proxmox::list_subdirs_api_method;
use proxmox_router::{Router, SubdirMap};
use proxmox_router::list_subdirs_api_method;
use proxmox::{identity, sortable};
pub mod tfa;

View File

@ -4,7 +4,8 @@ use anyhow::{bail, Error};
use serde_json::Value;
use ::serde::{Deserialize, Serialize};
use proxmox::api::{api, Permission, Router, RpcEnvironment};
use proxmox_router::{Router, RpcEnvironment, Permission};
use proxmox_schema::api;
use pbs_api_types::{
PROXMOX_CONFIG_DIGEST_SCHEMA, REALM_ID_SCHEMA, PRIV_SYS_AUDIT, PRIV_REALM_ALLOCATE,

View File

@ -3,8 +3,9 @@
use anyhow::Error;
use proxmox::api::{api, Permission, Router, RpcEnvironment, SubdirMap};
use proxmox::list_subdirs_api_method;
use proxmox_router::{Router, RpcEnvironment, Permission, SubdirMap};
use proxmox_schema::api;
use proxmox_router::list_subdirs_api_method;
use pbs_api_types::PROXMOX_CONFIG_DIGEST_SCHEMA;

View File

@ -8,10 +8,10 @@ use lazy_static::lazy_static;
use serde::{Deserialize, Serialize};
use serde_json::{json, Value};
use proxmox::api::router::SubdirMap;
use proxmox::api::{api, Permission, Router, RpcEnvironment};
use proxmox::http_bail;
use proxmox::list_subdirs_api_method;
use proxmox_router::{
http_bail, list_subdirs_api_method, Permission, Router, SubdirMap, RpcEnvironment,
};
use proxmox_schema::api;
use proxmox_acme_rs::account::AccountData as AcmeAccountData;
use proxmox_acme_rs::Account;

View File

@ -2,13 +2,8 @@ use anyhow::{bail, Error};
use ::serde::{Deserialize, Serialize};
use serde_json::Value;
use proxmox::api::{
api,
Router,
RpcEnvironment,
Permission,
schema::parse_property_string,
};
use proxmox_router::{Router, RpcEnvironment, Permission};
use proxmox_schema::{api, parse_property_string};
use pbs_api_types::{
Authid, ScsiTapeChanger, ScsiTapeChangerUpdater, LtoTapeDrive,

View File

@ -4,9 +4,9 @@ use anyhow::{bail, Error};
use serde_json::Value;
use ::serde::{Deserialize, Serialize};
use proxmox::api::{api, Router, RpcEnvironment, RpcEnvironmentType, Permission};
use proxmox::api::section_config::SectionConfigData;
use proxmox::api::schema::{ApiType, parse_property_string};
use proxmox_router::{Router, RpcEnvironment, RpcEnvironmentType, Permission};
use proxmox_schema::{api, ApiType, parse_property_string};
use proxmox_section_config::SectionConfigData;
use pbs_datastore::chunk_store::ChunkStore;
use pbs_config::BackupLockGuard;

View File

@ -2,7 +2,8 @@ use anyhow::{bail, Error};
use ::serde::{Deserialize, Serialize};
use serde_json::Value;
use proxmox::api::{api, Router, RpcEnvironment, Permission};
use proxmox_router::{Router, RpcEnvironment, Permission};
use proxmox_schema::api;
use pbs_api_types::{
Authid, LtoTapeDrive, LtoTapeDriveUpdater, ScsiTapeChanger,

View File

@ -1,14 +1,8 @@
use anyhow::{bail, Error};
use ::serde::{Deserialize, Serialize};
use proxmox::{
api::{
api,
Router,
RpcEnvironment,
Permission,
},
};
use proxmox_router::{Router, RpcEnvironment, Permission};
use proxmox_schema::api;
use pbs_api_types::{
Authid, MediaPoolConfig, MediaPoolConfigUpdater, MEDIA_POOL_NAME_SCHEMA,

View File

@ -1,7 +1,7 @@
//! Backup Server Configuration
use proxmox::api::router::{Router, SubdirMap};
use proxmox::list_subdirs_api_method;
use proxmox_router::{Router, SubdirMap};
use proxmox_router::list_subdirs_api_method;
pub mod access;
pub mod acme;

View File

@ -2,8 +2,8 @@ use anyhow::{bail, format_err, Error};
use serde_json::Value;
use ::serde::{Deserialize, Serialize};
use proxmox::api::{api, ApiMethod, Router, RpcEnvironment, Permission};
use proxmox::http_err;
use proxmox_router::{http_err, ApiMethod, Router, RpcEnvironment, Permission};
use proxmox_schema::api;
use pbs_client::{HttpClient, HttpClientOptions};
use pbs_api_types::{

View File

@ -2,7 +2,8 @@ use anyhow::{bail, Error};
use serde_json::Value;
use ::serde::{Deserialize, Serialize};
use proxmox::api::{api, Permission, Router, RpcEnvironment};
use proxmox_router::{Router, RpcEnvironment, Permission};
use proxmox_schema::api;
use pbs_api_types::{
Authid, SyncJobConfig, SyncJobConfigUpdater, JOB_ID_SCHEMA, PROXMOX_CONFIG_DIGEST_SCHEMA,

View File

@ -2,7 +2,8 @@ use anyhow::{bail, Error};
use serde_json::Value;
use ::serde::{Deserialize, Serialize};
use proxmox::api::{api, Router, RpcEnvironment, Permission};
use proxmox_router::{Router, RpcEnvironment, Permission};
use proxmox_schema::api;
use pbs_api_types::{
Authid, TapeBackupJobConfig, TapeBackupJobConfigUpdater,

View File

@ -1,15 +1,8 @@
use anyhow::{bail, Error};
use serde_json::Value;
use proxmox::{
api::{
api,
ApiMethod,
Router,
RpcEnvironment,
Permission,
},
};
use proxmox_router::{ApiMethod, Router, RpcEnvironment, Permission};
use proxmox_schema::api;
use pbs_api_types::{
Fingerprint, KeyInfo, Kdf,

View File

@ -2,7 +2,8 @@ use anyhow::{bail, Error};
use serde_json::Value;
use ::serde::{Deserialize, Serialize};
use proxmox::api::{api, Permission, Router, RpcEnvironment};
use proxmox_router::{Router, RpcEnvironment, Permission};
use proxmox_schema::api;
use pbs_api_types::{
Authid, VerificationJobConfig, VerificationJobConfigUpdater, JOB_ID_SCHEMA,

View File

@ -4,7 +4,7 @@ use anyhow::Error;
use futures::stream::TryStreamExt;
use hyper::{Body, Response, StatusCode, header};
use proxmox::http_bail;
use proxmox_router::http_bail;
pub async fn create_download_response(path: PathBuf) -> Result<Response<Body>, Error> {
let file = match tokio::fs::File::open(path.clone()).await {

View File

@ -14,9 +14,7 @@ pub mod pull;
pub mod tape;
pub mod helpers;
use proxmox::api::router::SubdirMap;
use proxmox::api::Router;
use proxmox::list_subdirs_api_method;
use proxmox_router::{list_subdirs_api_method, Router, SubdirMap};
const SUBDIRS: SubdirMap = &[
("access", &access::ROUTER),

View File

@ -2,10 +2,11 @@ use anyhow::{Error, bail, format_err};
use serde_json::{json, Value};
use std::collections::HashMap;
use proxmox::list_subdirs_api_method;
use proxmox::api::{api, RpcEnvironment, RpcEnvironmentType, Permission};
use proxmox::api::router::{Router, SubdirMap};
use proxmox::tools::fs::{replace_file, CreateOptions};
use proxmox_router::{
list_subdirs_api_method, RpcEnvironment, RpcEnvironmentType, Permission, Router, SubdirMap
};
use proxmox_schema::api;
use proxmox_apt::repositories::{
APTRepositoryFile, APTRepositoryFileError, APTRepositoryHandle, APTRepositoryInfo,

View File

@ -7,9 +7,10 @@ use openssl::pkey::PKey;
use openssl::x509::X509;
use serde::{Deserialize, Serialize};
use proxmox::api::router::SubdirMap;
use proxmox::api::{api, Permission, Router, RpcEnvironment};
use proxmox::list_subdirs_api_method;
use proxmox_router::SubdirMap;
use proxmox_router::{Permission, Router, RpcEnvironment};
use proxmox_router::list_subdirs_api_method;
use proxmox_schema::api;
use pbs_api_types::{NODE_SCHEMA, PRIV_SYS_MODIFY};
use pbs_buildcfg::configdir;
@ -516,7 +517,7 @@ pub fn renew_acme_cert(force: bool, rpcenv: &mut dyn RpcEnvironment) -> Result<S
/// Check whether the current certificate expires within the next 30 days.
pub fn cert_expires_soon() -> Result<bool, Error> {
let cert = pem_to_cert_info(get_certificate_pem()?.as_bytes())?;
cert.is_expired_after_epoch(proxmox::tools::time::epoch_i64() + 30 * 24 * 60 * 60)
cert.is_expired_after_epoch(proxmox_time::epoch_i64() + 30 * 24 * 60 * 60)
.map_err(|err| format_err!("Failed to check certificate expiration date: {}", err))
}

View File

@ -1,7 +1,8 @@
use anyhow::Error;
use ::serde::{Deserialize, Serialize};
use proxmox::api::{api, Permission, Router, RpcEnvironment};
use proxmox_router::{Permission, Router, RpcEnvironment};
use proxmox_schema::api;
use pbs_api_types::{NODE_SCHEMA, PRIV_SYS_AUDIT, PRIV_SYS_MODIFY};

View File

@ -2,9 +2,9 @@ use anyhow::{bail, Error};
use serde_json::json;
use ::serde::{Deserialize, Serialize};
use proxmox::api::{api, Permission, RpcEnvironment, RpcEnvironmentType};
use proxmox::api::section_config::SectionConfigData;
use proxmox::api::router::Router;
use proxmox_router::{Router, RpcEnvironment, RpcEnvironmentType, Permission};
use proxmox_schema::api;
use proxmox_section_config::SectionConfigData;
use pbs_api_types::{
DataStoreConfig, NODE_SCHEMA, BLOCKDEVICE_NAME_SCHEMA,

View File

@ -1,10 +1,11 @@
use anyhow::{bail, Error};
use serde_json::{json, Value};
use proxmox::api::{api, Permission, RpcEnvironment, RpcEnvironmentType};
use proxmox::api::router::{Router, SubdirMap};
use proxmox::{sortable, identity};
use proxmox::{list_subdirs_api_method};
use proxmox_router::{
list_subdirs_api_method, Router, RpcEnvironment, RpcEnvironmentType, SubdirMap, Permission,
};
use proxmox_schema::api;
use pbs_api_types::{
UPID_SCHEMA, NODE_SCHEMA, BLOCKDEVICE_NAME_SCHEMA,

View File

@ -1,11 +1,8 @@
use anyhow::{bail, Error};
use serde_json::{json, Value};
use proxmox::api::{
api, Permission, RpcEnvironment, RpcEnvironmentType,
schema::parse_property_string,
};
use proxmox::api::router::Router;
use proxmox_router::{Router, RpcEnvironment, RpcEnvironmentType, Permission};
use proxmox_schema::{api, parse_property_string};
use pbs_api_types::{
ZpoolListItem, ZfsRaidLevel, ZfsCompressionType, DataStoreConfig,

View File

@ -7,7 +7,8 @@ use regex::Regex;
use serde_json::{json, Value};
use ::serde::{Deserialize, Serialize};
use proxmox::api::{api, ApiMethod, Router, RpcEnvironment, Permission};
use proxmox_router::{ApiMethod, Router, RpcEnvironment, Permission};
use proxmox_schema::api;
use proxmox::tools::fs::{file_get_contents, replace_file, CreateOptions};
use proxmox::{IPRE, IPV4RE, IPV6RE, IPV4OCTET, IPV6H16, IPV6LS32};

View File

@ -4,7 +4,8 @@ use anyhow::{Error};
use serde_json::{json, Value};
use std::io::{BufRead,BufReader};
use proxmox::api::{api, ApiMethod, Router, RpcEnvironment, Permission};
use proxmox_router::{ApiMethod, Router, RpcEnvironment, Permission};
use proxmox_schema::api;
use pbs_api_types::{NODE_SCHEMA, PRIV_SYS_AUDIT};

View File

@ -12,12 +12,12 @@ use hyper::Request;
use serde_json::{json, Value};
use tokio::io::{AsyncBufReadExt, BufReader};
use proxmox::api::router::{Router, SubdirMap};
use proxmox::api::{
api, schema::*, ApiHandler, ApiMethod, ApiResponseFuture, Permission, RpcEnvironment,
};
use proxmox::list_subdirs_api_method;
use proxmox::{identity, sortable};
use proxmox_router::{
ApiHandler, ApiMethod, ApiResponseFuture, Permission, RpcEnvironment, Router, SubdirMap,
};
use proxmox_schema::*;
use proxmox_router::list_subdirs_api_method;
use proxmox_http::websocket::WebSocket;
use proxmox_rest_server::WorkerTask;

View File

@ -2,8 +2,8 @@ use anyhow::{Error, bail};
use serde_json::{Value, to_value};
use ::serde::{Deserialize, Serialize};
use proxmox::api::{api, ApiMethod, Router, RpcEnvironment, Permission};
use proxmox::api::schema::parse_property_string;
use proxmox_router::{ApiMethod, Router, RpcEnvironment, Permission};
use proxmox_schema::{api, parse_property_string};
use pbs_api_types::{
Authid, Interface, NetworkInterfaceType, LinuxBondMode, NetworkConfigMethod, BondXmitHashPolicy,

View File

@ -1,7 +1,9 @@
use anyhow::Error;
use proxmox::api::{api, ApiMethod, Permission, Router, RpcEnvironment};
use serde_json::{json, Value};
use proxmox_router::{ApiMethod, Permission, Router, RpcEnvironment};
use proxmox_schema::api;
use pbs_api_types::{NODE_SCHEMA, PRIV_SYS_AUDIT};
use crate::server::generate_report;

View File

@ -1,7 +1,8 @@
use anyhow::Error;
use serde_json::{Value, json};
use proxmox::api::{api, Permission, Router};
use proxmox_router::{Permission, Router};
use proxmox_schema::api;
use pbs_api_types::{
NODE_SCHEMA, RRDMode, RRDTimeFrameResolution, PRIV_SYS_AUDIT,
@ -19,7 +20,7 @@ pub fn create_value_from_rrd(
) -> Result<Value, Error> {
let mut result = Vec::new();
let now = proxmox::tools::time::epoch_f64();
let now = proxmox_time::epoch_f64();
for name in list {
let (start, reso, list) = match RRD_CACHE.extract_cached_data(basedir, name, now, timeframe, cf) {

View File

@ -3,9 +3,9 @@ use std::process::{Command, Stdio};
use anyhow::{bail, Error};
use serde_json::{json, Value};
use proxmox::{sortable, identity, list_subdirs_api_method};
use proxmox::api::{api, Router, Permission, RpcEnvironment};
use proxmox::api::router::SubdirMap;
use proxmox::{sortable, identity};
use proxmox_router::{list_subdirs_api_method, Router, Permission, RpcEnvironment, SubdirMap};
use proxmox_schema::api;
use pbs_api_types::{Authid, NODE_SCHEMA, SERVICE_ID_SCHEMA, PRIV_SYS_AUDIT, PRIV_SYS_MODIFY};

View File

@ -6,7 +6,8 @@ use serde_json::Value;
use proxmox::sys::linux::procfs;
use proxmox::api::{api, ApiMethod, Router, RpcEnvironment, Permission};
use proxmox_router::{ApiMethod, Router, RpcEnvironment, Permission};
use proxmox_schema::api;
use pbs_api_types::{NODE_SCHEMA, NodePowerCommand, PRIV_SYS_AUDIT, PRIV_SYS_POWER_MANAGEMENT};

View File

@ -1,7 +1,8 @@
use anyhow::{Error, format_err, bail};
use serde_json::Value;
use proxmox::api::{api, Router, RpcEnvironment, Permission};
use proxmox_router::{Router, RpcEnvironment, Permission};
use proxmox_schema::api;
use pbs_api_types::{
NODE_SCHEMA, SUBSCRIPTION_KEY_SCHEMA, Authid,
@ -51,7 +52,7 @@ pub fn check_subscription(
};
if !force && info.status == SubscriptionStatus::ACTIVE {
let age = proxmox::tools::time::epoch_i64() - info.checktime.unwrap_or(i64::MAX);
let age = proxmox_time::epoch_i64() - info.checktime.unwrap_or(i64::MAX);
if age < subscription::MAX_LOCAL_KEY_AGE {
return Ok(());
}

View File

@ -3,7 +3,8 @@ use std::process::{Command, Stdio};
use anyhow::{Error};
use serde_json::{json, Value};
use proxmox::api::{api, ApiMethod, Router, RpcEnvironment, Permission};
use proxmox_router::{ApiMethod, Router, RpcEnvironment, Permission};
use proxmox_schema::api;
use pbs_api_types::{NODE_SCHEMA, SYSTEMD_DATETIME_FORMAT, PRIV_SYS_AUDIT};

View File

@ -4,9 +4,9 @@ use std::io::{BufRead, BufReader};
use anyhow::{bail, Error};
use serde_json::{json, Value};
use proxmox::api::{api, Router, RpcEnvironment, Permission};
use proxmox::api::router::SubdirMap;
use proxmox::{identity, list_subdirs_api_method, sortable};
use proxmox::{identity, sortable};
use proxmox_router::{list_subdirs_api_method, Router, RpcEnvironment, Permission, SubdirMap};
use proxmox_schema::api;
use pbs_api_types::{
Userid, Authid, Tokenname, TaskListItem, TaskStateType, UPID,

View File

@ -1,8 +1,9 @@
use anyhow::{bail, format_err, Error};
use serde_json::{json, Value};
use proxmox::api::{api, Router, Permission};
use proxmox::tools::fs::{file_read_firstline, replace_file, CreateOptions};
use proxmox_router::{Router, Permission};
use proxmox_schema::api;
use pbs_api_types::{NODE_SCHEMA, TIME_ZONE_SCHEMA, PRIV_SYS_MODIFY};
@ -55,8 +56,8 @@ fn read_etc_localtime() -> Result<String, Error> {
)]
/// Read server time and time zone settings.
fn get_time(_param: Value) -> Result<Value, Error> {
let time = proxmox::tools::time::epoch_i64();
let tm = proxmox::tools::time::localtime(time)?;
let time = proxmox_time::epoch_i64();
let tm = proxmox_time::localtime(time)?;
let offset = tm.tm_gmtoff;
let localtime = time + offset;

View File

@ -3,7 +3,8 @@
use anyhow::{Error};
use serde_json::{json, Value};
use proxmox::api::{api, Router, Permission};
use proxmox_router::{Router, Permission};
use proxmox_schema::api;
#[api(
returns: {

View File

@ -4,8 +4,8 @@ use std::sync::{Arc};
use anyhow::{format_err, Error};
use futures::{select, future::FutureExt};
use proxmox::api::api;
use proxmox::api::{ApiMethod, Router, RpcEnvironment, Permission};
use proxmox_schema::api;
use proxmox_router::{ApiMethod, Router, RpcEnvironment, Permission};
use pbs_client::{HttpClient, BackupRepository};
use pbs_api_types::{

View File

@ -3,7 +3,7 @@ use std::collections::HashSet;
use serde_json::{json, Value};
use proxmox::api::{RpcEnvironment, RpcEnvironmentType};
use proxmox_router::{RpcEnvironment, RpcEnvironmentType};
use pbs_datastore::backup_info::BackupDir;
use pbs_datastore::DataStore;

View File

@ -7,25 +7,12 @@ use hyper::http::request::Parts;
use hyper::{Body, Response, Request, StatusCode};
use serde_json::Value;
use proxmox::{
http_err,
sortable,
identity,
list_subdirs_api_method,
api::{
ApiResponseFuture,
ApiHandler,
ApiMethod,
Router,
RpcEnvironment,
Permission,
router::SubdirMap,
schema::{
ObjectSchema,
BooleanSchema,
},
},
use proxmox::{identity, sortable};
use proxmox_router::{
http_err, list_subdirs_api_method, ApiHandler, ApiMethod, ApiResponseFuture, Permission,
Router, RpcEnvironment, SubdirMap,
};
use proxmox_schema::{BooleanSchema, ObjectSchema};
use pbs_api_types::{
Authid, DATASTORE_SCHEMA, BACKUP_TYPE_SCHEMA, BACKUP_TIME_SCHEMA, BACKUP_ID_SCHEMA,

View File

@ -1,18 +1,17 @@
//! Datastote status
use proxmox::list_subdirs_api_method;
use anyhow::{Error};
use serde_json::{json, Value};
use proxmox::api::{
api,
use proxmox_schema::api;
use proxmox_router::{
ApiMethod,
Permission,
Router,
RpcEnvironment,
SubdirMap,
};
use proxmox_router::list_subdirs_api_method;
use pbs_api_types::{
Authid, DATASTORE_SCHEMA, RRDMode, RRDTimeFrameResolution,
@ -122,7 +121,7 @@ pub fn datastore_status(
});
let rrd_dir = format!("datastore/{}", store);
let now = proxmox::tools::time::epoch_f64();
let now = proxmox_time::epoch_f64();
let get_rrd = |what: &str| RRD_CACHE.extract_cached_data(
&rrd_dir,

View File

@ -4,16 +4,9 @@ use std::sync::{Mutex, Arc};
use anyhow::{bail, format_err, Error};
use serde_json::Value;
use proxmox::{
try_block,
api::{
api,
RpcEnvironment,
RpcEnvironmentType,
Router,
Permission,
},
};
use proxmox_lang::try_block;
use proxmox_router::{Permission, Router, RpcEnvironment, RpcEnvironmentType};
use proxmox_schema::api;
use pbs_api_types::{
Authid, Userid, TapeBackupJobConfig, TapeBackupJobSetup, TapeBackupJobStatus, MediaPoolConfig,
@ -119,7 +112,7 @@ pub fn list_tape_backup_jobs(
let mut list = Vec::new();
let status_path = Path::new(TAPE_STATUS_DIR);
let current_time = proxmox::tools::time::epoch_i64();
let current_time = proxmox_time::epoch_i64();
for job in job_list_iter {
let privs = user_info.lookup_privs(&auth_id, &["tape", "job", &job.id]);

View File

@ -4,8 +4,8 @@ use std::path::Path;
use anyhow::Error;
use serde_json::Value;
use proxmox::api::{api, Router, SubdirMap, RpcEnvironment, Permission};
use proxmox::list_subdirs_api_method;
use proxmox_schema::api;
use proxmox_router::{list_subdirs_api_method, Permission, Router, RpcEnvironment, SubdirMap};
use pbs_api_types::{
Authid, ChangerListEntry, LtoTapeDrive, MtxEntryKind, MtxStatusEntry, ScsiTapeChanger,

View File

@ -6,21 +6,13 @@ use std::collections::HashMap;
use anyhow::{bail, format_err, Error};
use serde_json::Value;
use proxmox::{
sortable,
identity,
list_subdirs_api_method,
tools::Uuid,
api::{
api,
section_config::SectionConfigData,
RpcEnvironment,
RpcEnvironmentType,
Permission,
Router,
SubdirMap,
},
use proxmox::{sortable, identity};
use proxmox_router::{
list_subdirs_api_method, Permission, Router, RpcEnvironment, RpcEnvironmentType, SubdirMap,
};
use proxmox_schema::api;
use proxmox_section_config::SectionConfigData;
use proxmox_uuid::Uuid;
use pbs_api_types::{
UPID_SCHEMA, CHANGER_NAME_SCHEMA, DRIVE_NAME_SCHEMA, MEDIA_LABEL_SCHEMA, MEDIA_POOL_NAME_SCHEMA,
@ -521,7 +513,7 @@ pub fn label_media(
}
}
let ctime = proxmox::tools::time::epoch_i64();
let ctime = proxmox_time::epoch_i64();
let label = MediaLabel {
label_text: label_text.to_string(),
uuid: Uuid::generate(),
@ -1084,7 +1076,7 @@ fn barcode_label_media_worker(
}
}
let ctime = proxmox::tools::time::epoch_i64();
let ctime = proxmox_time::epoch_i64();
let label = MediaLabel {
label_text: label_text.to_string(),
uuid: Uuid::generate(),

View File

@ -3,11 +3,9 @@ use std::collections::HashSet;
use anyhow::{bail, format_err, Error};
use proxmox::{
api::{api, Router, SubdirMap, RpcEnvironment, Permission},
list_subdirs_api_method,
tools::Uuid,
};
use proxmox_router::{list_subdirs_api_method, Router, SubdirMap, RpcEnvironment, Permission};
use proxmox_schema::api;
use proxmox_uuid::Uuid;
use pbs_datastore::backup_info::BackupDir;
use pbs_api_types::{
@ -177,7 +175,7 @@ pub async fn list_media(
let changer_name = None; // assume standalone drive
let mut pool = MediaPool::with_config(status_path, &config, changer_name, true)?;
let current_time = proxmox::tools::time::epoch_i64();
let current_time = proxmox_time::epoch_i64();
// Call start_write_session, so that we show the same status a
// backup job would see.

View File

@ -3,14 +3,8 @@
use anyhow::Error;
use serde_json::Value;
use proxmox::{
api::{
api,
router::SubdirMap,
Router,
},
list_subdirs_api_method,
};
use proxmox_schema::api;
use proxmox_router::{list_subdirs_api_method, Router, SubdirMap};
use pbs_api_types::TapeDeviceInfo;
use pbs_tape::linux_list_drives::{lto_tape_device_list, linux_tape_changer_list};

View File

@ -8,25 +8,12 @@ use std::sync::Arc;
use anyhow::{bail, format_err, Error};
use serde_json::Value;
use proxmox::{
api::{
api,
RpcEnvironment,
RpcEnvironmentType,
Router,
Permission,
schema::parse_property_string,
section_config::SectionConfigData,
},
tools::{
Uuid,
io::ReadExt,
fs::{
replace_file,
CreateOptions,
},
},
};
use proxmox::tools::fs::{replace_file, CreateOptions};
use proxmox_io::ReadExt;
use proxmox_router::{Permission, Router, RpcEnvironment, RpcEnvironmentType};
use proxmox_schema::{api, parse_property_string};
use proxmox_section_config::SectionConfigData;
use proxmox_uuid::Uuid;
use pbs_api_types::{
Authid, Userid, CryptMode,
@ -441,7 +428,7 @@ fn restore_list_worker(
let mut snapshot_file_hash: BTreeMap<Uuid, Vec<u64>> = BTreeMap::new();
let mut snapshot_locks = HashMap::new();
let res = proxmox::try_block!({
let res = proxmox_lang::try_block!({
// assemble snapshot files/locks
for store_snapshot in snapshots.iter() {
let mut split = store_snapshot.splitn(2, ':');
@ -593,7 +580,7 @@ fn restore_list_worker(
"Phase 3: copy snapshots from temp dir to datastores"
);
for (store_snapshot, _lock) in snapshot_locks.into_iter() {
proxmox::try_block!({
proxmox_lang::try_block!({
let mut split = store_snapshot.splitn(2, ':');
let source_datastore = split
.next()

View File

@ -1,7 +1,7 @@
use serde::{Deserialize, Serialize};
use serde_json::Value;
use proxmox::api::{api, schema::{ApiType, Schema, StringSchema, ApiStringFormat}};
use proxmox_schema::{api, ApiType, Schema, StringSchema, ApiStringFormat};
use pbs_api_types::{
DNS_ALIAS_FORMAT, DNS_NAME_FORMAT, PROXMOX_SAFE_ID_FORMAT,
@ -62,7 +62,7 @@ pub struct KnownAcmeDirectory {
pub url: &'static str,
}
proxmox::api_string_type! {
proxmox_schema::api_string_type! {
#[api(format: &PROXMOX_SAFE_ID_FORMAT)]
/// ACME account name.
#[derive(Clone, Eq, PartialEq, Hash, Deserialize, Serialize)]

View File

@ -3,7 +3,7 @@
use anyhow::bail;
use serde::{Deserialize, Serialize};
use proxmox::api::{api, schema::*};
use proxmox_schema::*;
use pbs_api_types::StorageStatus;

View File

@ -3,8 +3,8 @@
use anyhow::{Error};
use serde_json::{json, Value};
use proxmox::api::{ApiHandler, ApiMethod, Router, RpcEnvironment, Permission};
use proxmox::api::schema::ObjectSchema;
use proxmox_router::{ApiHandler, ApiMethod, Router, RpcEnvironment, Permission};
use proxmox_schema::ObjectSchema;
fn get_version(
_param: Value,

View File

@ -7,7 +7,7 @@ use openssl::rsa::Rsa;
use openssl::sha;
use proxmox::tools::fs::{file_get_contents, replace_file, CreateOptions};
use proxmox::try_block;
use proxmox_lang::try_block;
use pbs_buildcfg::configdir;
use pbs_api_types::Userid;
@ -31,7 +31,7 @@ pub fn assemble_csrf_prevention_token(
userid: &Userid,
) -> String {
let epoch = proxmox::tools::time::epoch_i64();
let epoch = proxmox_time::epoch_i64();
let digest = compute_csrf_secret_digest(epoch, secret, userid);
@ -68,7 +68,7 @@ pub fn verify_csrf_prevention_token(
bail!("invalid signature.");
}
let now = proxmox::tools::time::epoch_i64();
let now = proxmox_time::epoch_i64();
let age = now - ttime;
if age < min_age {

View File

@ -361,7 +361,7 @@ pub fn verify_backup_dir_with_lock(
let mut verify_result = VerifyState::Ok;
for info in manifest.files() {
let result = proxmox::try_block!({
let result = proxmox_lang::try_block!({
task_log!(verify_worker.worker, " check {}", info.filename);
match archive_type(&info.filename)? {
ArchiveType::FixedIndex => verify_fixed_index(verify_worker, &backup_dir, info),
@ -556,7 +556,7 @@ pub fn verify_filter(
match outdated_after {
None => false, // never re-verify if ignored and no max age
Some(max_age) => {
let now = proxmox::tools::time::epoch_i64();
let now = proxmox_time::epoch_i64();
let days_since_last_verify = (now - last_verify.upid.starttime) / 86400;
days_since_last_verify > max_age

View File

@ -1,29 +1,10 @@
use anyhow::{bail, Error};
use serde_json::{json, Value};
use proxmox::{
api::{
schema::{
ApiType,
Schema,
ObjectSchemaType,
ApiStringFormat,
},
router::{
ApiAccess,
},
format::{
dump_enum_properties,
dump_section_config,
get_property_string_type_text,
},
ApiMethod,
ApiHandler,
Router,
SubRoute,
Permission,
},
};
use proxmox_router::{ApiAccess, ApiHandler, ApiMethod, Permission, Router, SubRoute};
use proxmox_schema::format::{dump_enum_properties, get_property_string_type_text};
use proxmox_schema::{ApiStringFormat, ApiType, ObjectSchemaType, Schema};
use proxmox_section_config::dump_section_config;
use pbs_api_types::PRIVILEGES;

View File

@ -8,10 +8,9 @@ use http::Response;
use hyper::{Body, Method, StatusCode};
use http::HeaderMap;
use proxmox::try_block;
use proxmox::api::RpcEnvironmentType;
use proxmox_lang::try_block;
use proxmox_router::{RpcEnvironmentType, UserInformation};
use proxmox::tools::fs::CreateOptions;
use proxmox::api::UserInformation;
use proxmox_rest_server::{daemon, AuthError, ApiConfig, RestServer, RestEnvironment, ServerAdapter};

View File

@ -1,4 +1,4 @@
use proxmox::api::{
use proxmox_router::{
cli::{run_cli_command, CliCommandMap, CliEnvironment},
RpcEnvironment,
};

View File

@ -4,8 +4,9 @@ use std::io::{self, Write};
use anyhow::{format_err, Error};
use serde_json::{json, Value};
use proxmox::api::{api, cli::*, RpcEnvironment};
use proxmox::tools::fs::CreateOptions;
use proxmox_router::{cli::*, RpcEnvironment};
use proxmox_schema::api;
use pbs_client::{display_task_log, view_task_result};
use pbs_tools::percent_encoding::percent_encode_component;
@ -434,7 +435,7 @@ pub fn complete_remote_datastore_name(_arg: &str, param: &HashMap<String, String
let mut list = Vec::new();
let _ = proxmox::try_block!({
let _ = proxmox_lang::try_block!({
let remote = param.get("remote").ok_or_else(|| format_err!("no remote"))?;
let data = pbs_runtime::block_on(async move {

View File

@ -17,10 +17,10 @@ use tokio_stream::wrappers::ReceiverStream;
use serde_json::{json, Value};
use http::{Method, HeaderMap};
use proxmox::try_block;
use proxmox::api::{RpcEnvironment, RpcEnvironmentType, UserInformation};
use proxmox::sys::linux::socket::set_tcp_keepalive;
use proxmox::tools::fs::CreateOptions;
use proxmox_lang::try_block;
use proxmox_router::{RpcEnvironment, RpcEnvironmentType, UserInformation};
use pbs_tools::{task_log, task_warn};
use pbs_datastore::DataStore;
@ -577,7 +577,7 @@ async fn schedule_datastore_garbage_collection() {
}
};
let now = proxmox::tools::time::epoch_i64();
let now = proxmox_time::epoch_i64();
if next > now { continue; }
@ -1021,7 +1021,7 @@ fn check_schedule(worker_type: &str, event_str: &str, id: &str) -> bool {
}
};
let now = proxmox::tools::time::epoch_i64();
let now = proxmox_time::epoch_i64();
next <= now
}

View File

@ -1,8 +1,8 @@
use anyhow::Error;
use serde_json::json;
use proxmox::api::{cli::*, RpcEnvironment, ApiHandler};
use proxmox::tools::fs::CreateOptions;
use proxmox_router::{cli::*, RpcEnvironment, ApiHandler};
use proxmox_backup::api2;
use proxmox_backup::tools::subscription;

View File

@ -1,18 +1,12 @@
use anyhow::{format_err, Error};
use serde_json::{json, Value};
use proxmox::{
api::{
api,
cli::*,
RpcEnvironment,
section_config::SectionConfigData,
},
tools::{
time::strftime_local,
io::ReadExt,
},
};
use proxmox_io::ReadExt;
use proxmox_router::RpcEnvironment;
use proxmox_router::cli::*;
use proxmox_schema::api;
use proxmox_section_config::SectionConfigData;
use proxmox_time::strftime_local;
use pbs_client::view_task_result;
use pbs_tools::format::{

View File

@ -7,13 +7,9 @@ use tokio::signal::unix::{signal, SignalKind};
use std::collections::HashMap;
use proxmox::api::{
api,
cli::*,
format::DocumentationFormat,
schema::{parse_parameter_strings, ApiType, ParameterSchema, Schema},
ApiHandler, ApiMethod, RpcEnvironment, SubRoute,
};
use proxmox_router::{cli::*, ApiHandler, ApiMethod, RpcEnvironment, SubRoute};
use proxmox_schema::{api, parse_parameter_strings, ApiType, ParameterSchema, Schema};
use proxmox_schema::format::DocumentationFormat;
use pbs_api_types::{PROXMOX_UPID_REGEX, UPID};
use pbs_client::view_task_result;
@ -381,8 +377,8 @@ struct ApiDirEntry {
capabilities: String,
}
const LS_SCHEMA: &proxmox::api::schema::Schema =
&proxmox::api::schema::ArraySchema::new("List of child links", &ApiDirEntry::API_SCHEMA)
const LS_SCHEMA: &proxmox_schema::Schema =
&proxmox_schema::ArraySchema::new("List of child links", &ApiDirEntry::API_SCHEMA)
.schema();
async fn get_api_children(
@ -448,7 +444,7 @@ async fn ls(path: Option<String>, mut param: Value, rpcenv: &mut dyn RpcEnvironm
format_and_print_result_full(
&mut serde_json::to_value(res)?,
&proxmox::api::schema::ReturnType {
&proxmox_schema::ReturnType {
optional: false,
schema: &LS_SCHEMA,
},

View File

@ -7,10 +7,11 @@ use anyhow::{bail, format_err, Error};
use serde_json::{json, Value};
use walkdir::WalkDir;
use proxmox::api::cli::{
use proxmox_router::cli::{
format_and_print_result, get_output_format, CliCommand, CliCommandMap, CommandLineInterface,
OUTPUT_FORMAT,
};
use proxmox::api::{api, cli::*};
use proxmox_schema::api;
use pbs_tools::cli::outfile_or_stdout;
use pbs_tools::crypt_config::CryptConfig;
@ -282,7 +283,7 @@ fn inspect_file(
};
let mut ctime_str = index.index_ctime().to_string();
if let Ok(s) = proxmox::tools::time::strftime_local("%c", index.index_ctime()) {
if let Ok(s) = proxmox_time::strftime_local("%c", index.index_ctime()) {
ctime_str = s;
}

View File

@ -5,9 +5,9 @@ use std::path::Path;
use anyhow::{bail, format_err, Error};
use serde_json::Value;
use proxmox::api::api;
use proxmox::api::cli::{CliCommand, CliCommandMap, CommandLineInterface};
use proxmox::tools::digest_to_hex;
use proxmox_router::cli::{CliCommand, CliCommandMap, CommandLineInterface};
use proxmox_schema::api;
use pbs_tools::crypt_config::CryptConfig;
use pbs_datastore::dynamic_index::DynamicIndexReader;

View File

@ -1,7 +1,8 @@
use anyhow::{bail, Error};
use serde_json::Value;
use proxmox::api::{api, cli::*, RpcEnvironment, ApiHandler};
use proxmox_router::{cli::*, ApiHandler, RpcEnvironment};
use proxmox_schema::api;
use proxmox_backup::api2;

View File

@ -3,8 +3,9 @@ use std::io::Write;
use anyhow::{bail, Error};
use serde_json::Value;
use proxmox::api::{api, cli::*, ApiHandler, RpcEnvironment};
use proxmox::tools::fs::file_get_contents;
use proxmox_router::{cli::*, ApiHandler, RpcEnvironment};
use proxmox_schema::api;
use proxmox_backup::acme::AcmeClient;
use proxmox_backup::api2;

View File

@ -1,6 +1,7 @@
use anyhow::{bail, Error};
use proxmox::api::{api, cli::*};
use proxmox_router::cli::*;
use proxmox_schema::api;
use proxmox_backup::config;
use proxmox_backup::auth_helpers::*;

View File

@ -1,7 +1,8 @@
use anyhow::Error;
use serde_json::Value;
use proxmox::api::{api, cli::*, RpcEnvironment, ApiHandler};
use proxmox_router::{cli::*, ApiHandler, RpcEnvironment};
use proxmox_schema::api;
use pbs_client::view_task_result;
use pbs_api_types::{DataStoreConfig, DATASTORE_SCHEMA};

View File

@ -1,7 +1,8 @@
use anyhow::{bail, Error};
use serde_json::Value;
use proxmox::api::{api, cli::*, RpcEnvironment, ApiHandler};
use proxmox_router::{cli::*, ApiHandler, RpcEnvironment};
use proxmox_schema::api;
use pbs_api_types::{
DISK_LIST_SCHEMA, ZFS_ASHIFT_SCHEMA, ZfsRaidLevel, ZfsCompressionType,

View File

@ -1,7 +1,8 @@
use anyhow::Error;
use serde_json::Value;
use proxmox::api::{api, cli::*, RpcEnvironment, ApiHandler};
use proxmox_router::{cli::*, ApiHandler, RpcEnvironment};
use proxmox_schema::api;
use proxmox_backup::api2;

View File

@ -1,7 +1,8 @@
use anyhow::Error;
use serde_json::Value;
use proxmox::api::{api, cli::*, RpcEnvironment, ApiHandler};
use proxmox_router::{cli::*, ApiHandler, RpcEnvironment};
use proxmox_schema::api;
use proxmox_backup::api2;

View File

@ -1,7 +1,9 @@
use proxmox::api::{api, cli::*, ApiHandler, RpcEnvironment};
use anyhow::Error;
use serde_json::Value;
use proxmox_router::{cli::*, ApiHandler, RpcEnvironment};
use proxmox_schema::api;
use proxmox_backup::api2;
#[api(

View File

@ -1,7 +1,8 @@
use anyhow::Error;
use serde_json::Value;
use proxmox::api::{api, cli::*, RpcEnvironment, ApiHandler};
use proxmox_router::{cli::*, ApiHandler, RpcEnvironment};
use proxmox_schema::api;
use pbs_api_types::REALM_ID_SCHEMA;

View File

@ -1,7 +1,8 @@
use anyhow::Error;
use serde_json::Value;
use proxmox::api::{api, cli::*, RpcEnvironment, ApiHandler};
use proxmox_router::{cli::*, ApiHandler, RpcEnvironment};
use proxmox_schema::api;
use pbs_api_types::REMOTE_ID_SCHEMA;

View File

@ -1,7 +1,8 @@
use anyhow::Error;
use serde_json::Value;
use proxmox::api::{api, cli::*, RpcEnvironment, ApiHandler};
use proxmox_router::{cli::*, ApiHandler, RpcEnvironment};
use proxmox_schema::api;
use proxmox_backup::api2;

View File

@ -1,7 +1,8 @@
use anyhow::Error;
use serde_json::Value;
use proxmox::api::{api, cli::*, RpcEnvironment, ApiHandler};
use proxmox_router::{cli::*, ApiHandler, RpcEnvironment};
use proxmox_schema::api;
use pbs_api_types::JOB_ID_SCHEMA;

View File

@ -3,7 +3,8 @@ use serde_json::Value;
use std::collections::HashMap;
use proxmox::api::{api, cli::*, RpcEnvironment, ApiHandler};
use proxmox_router::{cli::*, ApiHandler, RpcEnvironment};
use proxmox_schema::api;
use pbs_api_types::{ACL_PATH_SCHEMA, Authid, Userid};
@ -15,7 +16,7 @@ fn render_expire(value: &Value, _record: &Value) -> Result<String, Error> {
let text = match value.as_i64() {
Some(epoch) if epoch == 0 => never,
Some(epoch) => {
if let Ok(epoch_string) = proxmox::tools::time::strftime_local("%c", epoch as i64) {
if let Ok(epoch_string) = proxmox_time::strftime_local("%c", epoch as i64) {
epoch_string
} else {
epoch.to_string()

View File

@ -1,7 +1,8 @@
use anyhow::Error;
use serde_json::Value;
use proxmox::api::{api, cli::*, RpcEnvironment, ApiHandler};
use proxmox_router::{cli::*, ApiHandler, RpcEnvironment};
use proxmox_schema::api;
use pbs_api_types::JOB_ID_SCHEMA;

View File

@ -1,7 +1,8 @@
use anyhow::Error;
use serde_json::Value;
use proxmox::api::{api, cli::*, RpcEnvironment, ApiHandler};
use proxmox_router::{cli::*, ApiHandler, RpcEnvironment};
use proxmox_schema::api;
use pbs_api_types::JOB_ID_SCHEMA;
use pbs_client::view_task_result;

View File

@ -1,15 +1,9 @@
use anyhow::{bail, Error};
use serde_json::Value;
use proxmox::{
api::{
api,
cli::*,
RpcEnvironment,
ApiHandler,
section_config::SectionConfigData,
},
};
use proxmox_router::{cli::*, ApiHandler, RpcEnvironment};
use proxmox_schema::api;
use proxmox_section_config::SectionConfigData;
use pbs_config::drive::{
complete_drive_name,

View File

@ -1,14 +1,8 @@
use anyhow::Error;
use serde_json::Value;
use proxmox::{
api::{
api,
cli::*,
RpcEnvironment,
ApiHandler,
},
};
use proxmox_router::{cli::*, ApiHandler, RpcEnvironment};
use proxmox_schema::api;
use pbs_api_types::DRIVE_NAME_SCHEMA;

View File

@ -1,15 +1,9 @@
use anyhow::{bail, Error};
use serde_json::Value;
use proxmox::{
api::{
api,
cli::*,
RpcEnvironment,
ApiHandler,
},
sys::linux::tty,
};
use proxmox_router::{cli::*, ApiHandler, RpcEnvironment};
use proxmox_schema::api;
use proxmox::sys::linux::tty;
use pbs_api_types::{
Fingerprint, Kdf, DRIVE_NAME_SCHEMA, TAPE_ENCRYPTION_KEY_FINGERPRINT_SCHEMA,
@ -127,7 +121,7 @@ fn show_key(
_ => unreachable!(),
};
let options = proxmox::api::cli::default_table_format_options()
let options = proxmox_router::cli::default_table_format_options()
.column(ColumnConfig::new("kdf"))
.column(ColumnConfig::new("created").renderer(pbs_tools::format::render_epoch))
.column(ColumnConfig::new("modified").renderer(pbs_tools::format::render_epoch))

View File

@ -1,14 +1,8 @@
use anyhow::{Error};
use serde_json::Value;
use proxmox::{
api::{
api,
cli::*,
RpcEnvironment,
ApiHandler,
},
};
use proxmox_router::{cli::*, ApiHandler, RpcEnvironment};
use proxmox_schema::api;
use pbs_api_types::{
MEDIA_POOL_NAME_SCHEMA, CHANGER_NAME_SCHEMA, MediaStatus, MediaListEntry,

View File

@ -1,14 +1,8 @@
use anyhow::{Error};
use serde_json::Value;
use proxmox::{
api::{
api,
cli::*,
RpcEnvironment,
ApiHandler,
},
};
use proxmox_router::{cli::*, ApiHandler, RpcEnvironment};
use proxmox_schema::api;
use pbs_api_types::MEDIA_POOL_NAME_SCHEMA;
use pbs_config::media_pool::complete_pool_name;

View File

@ -9,14 +9,9 @@ use std::os::unix::io::{AsRawFd, FromRawFd};
use anyhow::{bail, Error};
use serde_json::Value;
use proxmox::{
api::{
api,
cli::*,
RpcEnvironment,
},
tools::Uuid,
};
use proxmox_router::{cli::*, RpcEnvironment};
use proxmox_schema::api;
use proxmox_uuid::Uuid;
use pbs_api_types::{
Fingerprint, LTO_DRIVE_PATH_SCHEMA, DRIVE_NAME_SCHEMA, TAPE_ENCRYPTION_KEY_FINGERPRINT_SCHEMA,
@ -112,7 +107,7 @@ fn set_encryption(
param: Value,
) -> Result<(), Error> {
let result = proxmox::try_block!({
let result = proxmox_lang::try_block!({
let mut handle = get_tape_handle(&param)?;
match (fingerprint, uuid) {

View File

@ -3,11 +3,8 @@ use lazy_static::lazy_static;
use serde::{Deserialize, Serialize};
use serde_json::Value;
use proxmox::api::{
api,
schema::*,
section_config::{SectionConfig, SectionConfigData, SectionConfigPlugin},
};
use proxmox_schema::{api, ApiType, Schema, StringSchema, Updater};
use proxmox_section_config::{SectionConfig, SectionConfigData, SectionConfigPlugin};
use pbs_config::{open_backup_lockfile, BackupLockGuard};
use pbs_api_types::PROXMOX_SAFE_ID_FORMAT;

View File

@ -10,7 +10,7 @@ use openssl::rsa::{Rsa};
use openssl::x509::{X509Builder};
use openssl::pkey::PKey;
use proxmox::try_block;
use proxmox_lang::try_block;
use pbs_buildcfg::{self, configdir};
@ -115,7 +115,7 @@ pub fn update_self_signed_cert(force: bool) -> Result<(), Error> {
// we try to generate an unique 'subject' to avoid browser problems
//(reused serial numbers, ..)
let uuid = proxmox::tools::uuid::Uuid::generate();
let uuid = proxmox_uuid::Uuid::generate();
let mut subject_name = openssl::x509::X509NameBuilder::new()?;
subject_name.append_entry_by_text("O", "Proxmox Backup Server")?;

View File

@ -3,8 +3,7 @@ use std::collections::HashSet;
use anyhow::{bail, Error};
use serde::{Deserialize, Serialize};
use proxmox::api::api;
use proxmox::api::schema::{ApiStringFormat, ApiType, Updater};
use proxmox_schema::{api, ApiStringFormat, ApiType, Updater};
use proxmox_http::ProxyConfig;

View File

@ -16,14 +16,11 @@ use webauthn_rs::{proto::UserVerificationPolicy, Webauthn};
use webauthn_rs::proto::Credential as WebauthnCredential;
use proxmox::api::api;
use proxmox::api::schema::Updater;
use proxmox::sys::error::SysError;
use proxmox::tools::fs::CreateOptions;
use proxmox::tools::tfa::totp::Totp;
use proxmox::tools::tfa::u2f;
use proxmox::tools::uuid::Uuid;
use proxmox::tools::AsHex;
use proxmox_schema::{api, Updater};
use proxmox_tfa::{totp::Totp, u2f};
use proxmox_uuid::Uuid;
use pbs_buildcfg::configdir;
use pbs_config::{open_backup_lockfile, BackupLockGuard};
@ -276,7 +273,7 @@ impl TfaConfig {
}
/// Remove non-existent users.
pub fn cleanup_users(&mut self, config: &proxmox::api::section_config::SectionConfigData) {
pub fn cleanup_users(&mut self, config: &proxmox_section_config::SectionConfigData) {
self.users
.retain(|user, _| config.lookup::<User>("user", user.as_str()).is_ok());
}
@ -341,7 +338,7 @@ impl<T> TfaEntry<T> {
id: Uuid::generate().to_string(),
enable: true,
description,
created: proxmox::tools::time::epoch_i64(),
created: proxmox_time::epoch_i64(),
},
entry,
}
@ -371,7 +368,7 @@ impl U2fRegistrationChallenge {
Self {
challenge,
description,
created: proxmox::tools::time::epoch_i64(),
created: proxmox_time::epoch_i64(),
}
}
}
@ -410,7 +407,7 @@ impl WebauthnRegistrationChallenge {
state,
challenge,
description,
created: proxmox::tools::time::epoch_i64(),
created: proxmox_time::epoch_i64(),
}
}
}
@ -441,7 +438,7 @@ impl WebauthnAuthChallenge {
Self {
state,
challenge,
created: proxmox::tools::time::epoch_i64(),
created: proxmox_time::epoch_i64(),
}
}
}
@ -614,7 +611,7 @@ impl TfaUserChallengeData {
challenge: &str,
response: &str,
) -> Result<TfaEntry<u2f::Registration>, Error> {
let expire_before = proxmox::tools::time::epoch_i64() - CHALLENGE_TIMEOUT;
let expire_before = proxmox_time::epoch_i64() - CHALLENGE_TIMEOUT;
let index = self
.inner
@ -659,7 +656,7 @@ impl TfaUserChallengeData {
response: webauthn_rs::proto::RegisterPublicKeyCredential,
existing_registrations: &[TfaEntry<WebauthnCredential>],
) -> Result<TfaEntry<WebauthnCredential>, Error> {
let expire_before = proxmox::tools::time::epoch_i64() - CHALLENGE_TIMEOUT;
let expire_before = proxmox_time::epoch_i64() - CHALLENGE_TIMEOUT;
let index = self
.inner
@ -991,7 +988,7 @@ impl TfaUserData {
mut webauthn: Webauthn<WebauthnConfig>,
mut response: Value,
) -> Result<(), Error> {
let expire_before = proxmox::tools::time::epoch_i64() - CHALLENGE_TIMEOUT;
let expire_before = proxmox_time::epoch_i64() - CHALLENGE_TIMEOUT;
let challenge = match response
.as_object_mut()
@ -1083,9 +1080,9 @@ impl Recovery {
proxmox::sys::linux::fill_with_random_data(&mut secret)?;
let mut this = Self {
secret: AsHex(&secret).to_string(),
secret: hex::encode(&secret).to_string(),
entries: Vec::with_capacity(10),
created: proxmox::tools::time::epoch_i64(),
created: proxmox_time::epoch_i64(),
};
let mut original = Vec::new();
@ -1093,14 +1090,11 @@ impl Recovery {
let mut key_data = [0u8; 80]; // 10 keys of 12 bytes
proxmox::sys::linux::fill_with_random_data(&mut key_data)?;
for b in key_data.chunks(8) {
// unwrap: encoding hex bytes to fixed sized arrays
let entry = format!(
"{}-{}-{}-{}",
AsHex(&b[0..2]),
AsHex(&b[2..4]),
AsHex(&b[4..6]),
AsHex(&b[6..8]),
"{:02x}{:02x}-{:02x}{:02x}-{:02x}{:02x}-{:02x}{:02x}",
b[0], b[1], b[2], b[3], b[4], b[5], b[6], b[7],
);
this.entries.push(Some(this.hash(entry.as_bytes())?));
original.push(entry);
}
@ -1120,7 +1114,7 @@ impl Recovery {
.sign_oneshot_to_vec(data)
.map_err(|err| format_err!("error calculating hmac: {}", err))?;
Ok(AsHex(&hmac).to_string())
Ok(hex::encode(&hmac))
}
/// Iterator over available keys.
@ -1159,7 +1153,7 @@ where
D: Deserializer<'de>,
T: Deserialize<'de> + IsExpired,
{
let expire_before = proxmox::tools::time::epoch_i64() - CHALLENGE_TIMEOUT;
let expire_before = proxmox_time::epoch_i64() - CHALLENGE_TIMEOUT;
Ok(
deserializer.deserialize_seq(crate::tools::serde_filter::FilteredVecVisitor::new(
"a challenge entry",

View File

@ -2,7 +2,7 @@
use anyhow::format_err;
use proxmox::api::UserInformation;
use proxmox_router::UserInformation;
use pbs_tools::ticket::{self, Ticket};
use pbs_config::{token_shadow, CachedUserInfo};

Some files were not shown because too many files have changed in this diff Show More