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

@ -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) {