From cad540e96902db182ac6c0f6c1de6a5c3c0a98e3 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Thu, 21 Nov 2019 14:53:15 +0100 Subject: [PATCH] api/compat: remove remaining api_schema references Signed-off-by: Wolfgang Bumiller --- src/api2/access.rs | 7 ++++--- src/api2/admin/datastore.rs | 29 ++++++++++++++--------------- src/api2/backup.rs | 10 +++++----- src/api2/node/services.rs | 19 ++++++++++--------- src/api2/node/tasks.rs | 14 ++++++++------ src/api2/node/time.rs | 4 ++-- src/api2/reader.rs | 17 ++++++++--------- src/api2/types.rs | 8 +++++--- src/api_schema.rs | 10 ---------- src/bin/pxar.rs | 4 ++-- src/cli/getopts.rs | 5 ++--- src/client/backup_repo.rs | 7 ++++--- src/config/datastore.rs | 2 +- src/section_config.rs | 3 +-- src/storage/config.rs | 8 ++++---- 15 files changed, 70 insertions(+), 77 deletions(-) diff --git a/src/api2/access.rs b/src/api2/access.rs index 2d77a946..e7ba4790 100644 --- a/src/api2/access.rs +++ b/src/api2/access.rs @@ -3,14 +3,15 @@ use failure::*; use serde_json::{json, Value}; use proxmox::{sortable, identity}; +use proxmox::api::{http_err, list_subdirs_api_method}; +use proxmox::api::{ApiHandler, ApiMethod, Router, RpcEnvironment}; +use proxmox::api::router::SubdirMap; +use proxmox::api::schema::*; use crate::tools; -use crate::api_schema::*; -use crate::api_schema::router::*; use crate::tools::ticket::*; use crate::auth_helpers::*; - fn authenticate_user(username: &str, password: &str) -> Result<(), Error> { let ticket_lifetime = tools::ticket::TICKET_LIFETIME; diff --git a/src/api2/admin/datastore.rs b/src/api2/admin/datastore.rs index 17e65cd2..a7a37443 100644 --- a/src/api2/admin/datastore.rs +++ b/src/api2/admin/datastore.rs @@ -1,26 +1,25 @@ -use failure::*; -use futures::*; - -use crate::tools; -use crate::api2::types::*; -use crate::api_schema::*; -use crate::api_schema::router::*; -//use crate::server::rest::*; -use serde_json::{json, Value}; use std::collections::{HashSet, HashMap}; -use chrono::{DateTime, Datelike, TimeZone, Local}; use std::path::PathBuf; +use chrono::{DateTime, Datelike, TimeZone, Local}; +use failure::*; +use futures::*; +use hyper::http::request::Parts; +use hyper::{header, Body, Response, StatusCode}; +use serde_json::{json, Value}; + use proxmox::{sortable, identity}; +use proxmox::api::{http_err, list_subdirs_api_method}; +use proxmox::api::{ApiFuture, ApiHandler, ApiMethod, Router, RpcEnvironment, RpcEnvironmentType}; +use proxmox::api::router::SubdirMap; +use proxmox::api::schema::*; use proxmox::tools::{try_block, fs::file_get_contents, fs::file_set_contents}; -use crate::config::datastore; - +use crate::api2::types::*; use crate::backup::*; +use crate::config::datastore; use crate::server::WorkerTask; - -use hyper::{header, Body, Response, StatusCode}; -use hyper::http::request::Parts; +use crate::tools; fn read_backup_index(store: &DataStore, backup_dir: &BackupDir) -> Result { diff --git a/src/api2/backup.rs b/src/api2/backup.rs index e3cfd230..4860f0be 100644 --- a/src/api2/backup.rs +++ b/src/api2/backup.rs @@ -1,18 +1,18 @@ use failure::*; - use futures::*; use hyper::header::{HeaderValue, UPGRADE}; -use hyper::{Body, Response, StatusCode}; use hyper::http::request::Parts; - +use hyper::{Body, Response, StatusCode}; use serde_json::{json, Value}; use proxmox::{sortable, identity}; +use proxmox::api::list_subdirs_api_method; +use proxmox::api::{ApiFuture, ApiHandler, ApiMethod, Router, RpcEnvironment}; +use proxmox::api::router::SubdirMap; +use proxmox::api::schema::*; use crate::tools; use crate::tools::wrapped_reader_stream::*; -use crate::api_schema::router::*; -use crate::api_schema::*; use crate::server::{WorkerTask, H2Service}; use crate::backup::*; use crate::api2::types::*; diff --git a/src/api2/node/services.rs b/src/api2/node/services.rs index a59f6266..c2e7a71f 100644 --- a/src/api2/node/services.rs +++ b/src/api2/node/services.rs @@ -1,15 +1,16 @@ -use failure::*; - -use proxmox::{sortable, identity}; - -use crate::tools; -use crate::api_schema::*; -use crate::api_schema::router::*; -use serde_json::{json, Value}; - use std::process::{Command, Stdio}; +use failure::*; +use serde_json::{json, Value}; + +use proxmox::{sortable, identity}; +use proxmox::api::list_subdirs_api_method; +use proxmox::api::{ApiHandler, ApiMethod, Router, RpcEnvironment}; +use proxmox::api::router::SubdirMap; +use proxmox::api::schema::*; + use crate::api2::types::*; +use crate::tools; static SERVICE_NAME_LIST: [&str; 7] = [ "proxmox-backup", diff --git a/src/api2/node/tasks.rs b/src/api2/node/tasks.rs index 9e5c949c..38b2b5d2 100644 --- a/src/api2/node/tasks.rs +++ b/src/api2/node/tasks.rs @@ -1,14 +1,16 @@ -use failure::*; - -use serde_json::{json, Value}; use std::fs::File; -use std::io::{BufRead,BufReader}; +use std::io::{BufRead, BufReader}; + +use failure::*; +use serde_json::{json, Value}; use proxmox::{sortable, identity}; +use proxmox::api::list_subdirs_api_method; +use proxmox::api::{ApiHandler, ApiMethod, Router, RpcEnvironment}; +use proxmox::api::router::SubdirMap; +use proxmox::api::schema::*; use crate::tools; -use crate::api_schema::*; -use crate::api_schema::router::*; use crate::api2::types::*; use crate::server::{self, UPID}; diff --git a/src/api2/node/time.rs b/src/api2/node/time.rs index 54792127..77a8a361 100644 --- a/src/api2/node/time.rs +++ b/src/api2/node/time.rs @@ -5,11 +5,11 @@ use failure::*; use serde_json::{json, Value}; use proxmox::{sortable, identity}; +use proxmox::api::{ApiHandler, ApiMethod, Router, RpcEnvironment}; +use proxmox::api::schema::*; use proxmox::tools::fs::{file_read_firstline, file_set_contents}; use crate::api2::types::*; -use crate::api_schema::router::*; -use crate::api_schema::*; fn read_etc_localtime() -> Result { // use /etc/timezone diff --git a/src/api2/reader.rs b/src/api2/reader.rs index f809a51f..575803fa 100644 --- a/src/api2/reader.rs +++ b/src/api2/reader.rs @@ -1,21 +1,20 @@ +//use chrono::{Local, TimeZone}; use failure::*; - use futures::*; use hyper::header::{self, HeaderValue, UPGRADE}; -use hyper::{Body, Response, StatusCode}; use hyper::http::request::Parts; -//use chrono::{Local, TimeZone}; - +use hyper::{Body, Response, StatusCode}; use serde_json::Value; use proxmox::{sortable, identity}; +use proxmox::api::http_err; +use proxmox::api::{ApiFuture, ApiHandler, ApiMethod, Router, RpcEnvironment}; +use proxmox::api::schema::*; -use crate::tools; -use crate::api_schema::router::*; -use crate::api_schema::*; -use crate::server::{WorkerTask, H2Service}; -use crate::backup::*; use crate::api2::types::*; +use crate::backup::*; +use crate::server::{WorkerTask, H2Service}; +use crate::tools; mod environment; use environment::*; diff --git a/src/api2/types.rs b/src/api2/types.rs index 5de2945f..d7dca592 100644 --- a/src/api2/types.rs +++ b/src/api2/types.rs @@ -1,8 +1,10 @@ -use failure::*; -//use lazy_static::lazy_static; //use std::sync::Arc; -use crate::api_schema::*; +use failure::*; +//use lazy_static::lazy_static; + +use proxmox::api::const_regex; +use proxmox::api::schema::*; use proxmox::tools::*; // required to use IPRE!() macro ??? // File names: may not contain slashes, may not start with "." diff --git a/src/api_schema.rs b/src/api_schema.rs index 9d6d7606..5ac6a0b3 100644 --- a/src/api_schema.rs +++ b/src/api_schema.rs @@ -11,13 +11,3 @@ //pub mod registry; pub mod config; pub mod format; - -/* - * -------------------------------------------------------------------------------------------- - * Everything below is a compatibility layer to support building the current code until api2.rs - * and the api2/ directory have been updated to the proxmox::api crate: - * -------------------------------------------------------------------------------------------- - */ - -pub use proxmox::api::schema::*; -pub use proxmox::api::*; diff --git a/src/bin/pxar.rs b/src/bin/pxar.rs index b3676c7b..d4e50d45 100644 --- a/src/bin/pxar.rs +++ b/src/bin/pxar.rs @@ -3,11 +3,11 @@ extern crate proxmox_backup; use failure::*; use proxmox::{sortable, identity}; +use proxmox::api::{ApiHandler, ApiMethod, RpcEnvironment}; +use proxmox::api::schema::*; use proxmox_backup::tools; use proxmox_backup::cli::*; -use proxmox_backup::api_schema::*; -use proxmox_backup::api_schema::router::*; use serde_json::{Value}; diff --git a/src/cli/getopts.rs b/src/cli/getopts.rs index c25304fc..858a56bc 100644 --- a/src/cli/getopts.rs +++ b/src/cli/getopts.rs @@ -1,9 +1,8 @@ -use crate::api_schema::*; - use failure::*; - use serde_json::Value; +use proxmox::api::schema::*; + #[derive(Debug)] enum RawArgument { Separator, diff --git a/src/client/backup_repo.rs b/src/client/backup_repo.rs index 4b3b5f6c..ed4aeffa 100644 --- a/src/client/backup_repo.rs +++ b/src/client/backup_repo.rs @@ -1,8 +1,9 @@ +use std::fmt; + use failure::*; -use crate::api_schema::*; - -use std::fmt; +use proxmox::api::const_regex; +use proxmox::api::schema::*; const_regex! { /// Regular expression to parse repository URLs diff --git a/src/config/datastore.rs b/src/config/datastore.rs index 6b3487ca..855ab3ac 100644 --- a/src/config/datastore.rs +++ b/src/config/datastore.rs @@ -5,8 +5,8 @@ use failure::*; use lazy_static::lazy_static; use proxmox::tools::{fs::file_set_contents, try_block}; +use proxmox::api::schema::{Schema, ObjectSchema, StringSchema}; -use crate::api_schema::{Schema, ObjectSchema, StringSchema}; use crate::section_config::{SectionConfig, SectionConfigData, SectionConfigPlugin}; lazy_static! { diff --git a/src/section_config.rs b/src/section_config.rs index 9c27facc..dd0ae83d 100644 --- a/src/section_config.rs +++ b/src/section_config.rs @@ -6,10 +6,9 @@ use std::collections::VecDeque; use serde_json::{json, Value}; +use proxmox::api::schema::*; use proxmox::tools::try_block; -use crate::api_schema::*; - pub struct SectionConfigPlugin { type_name: String, properties: &'static ObjectSchema, diff --git a/src/storage/config.rs b/src/storage/config.rs index 418a8879..73818953 100644 --- a/src/storage/config.rs +++ b/src/storage/config.rs @@ -1,10 +1,10 @@ use failure::*; - -use crate::api_schema::*; -use crate::section_config::*; - use lazy_static::lazy_static; +use proxmox::api::schema::*; + +use crate::section_config::*; + lazy_static!{ static ref STORAGE_SECTION_CONFIG: SectionConfig = register_storage_plugins(); }