diff --git a/src/api2.rs b/src/api2.rs index 5cd2bce6..7993a608 100644 --- a/src/api2.rs +++ b/src/api2.rs @@ -1,7 +1,7 @@ //use failure::*; -use crate::api::schema::*; -use crate::api::router::*; +use crate::api_schema::schema::*; +use crate::api_schema::router::*; use serde_json::{json}; use std::sync::Arc; diff --git a/src/api2/access.rs b/src/api2/access.rs index 24811fb1..851248d8 100644 --- a/src/api2/access.rs +++ b/src/api2/access.rs @@ -1,8 +1,8 @@ use failure::*; use crate::tools; -use crate::api::schema::*; -use crate::api::router::*; +use crate::api_schema::schema::*; +use crate::api_schema::router::*; use crate::tools::ticket::*; use crate::auth_helpers::*; diff --git a/src/api2/admin.rs b/src/api2/admin.rs index 4f42d900..a89d4373 100644 --- a/src/api2/admin.rs +++ b/src/api2/admin.rs @@ -1,5 +1,5 @@ -use crate::api::schema::*; -use crate::api::router::*; +use crate::api_schema::schema::*; +use crate::api_schema::router::*; use serde_json::{json}; pub mod datastore; diff --git a/src/api2/admin/datastore.rs b/src/api2/admin/datastore.rs index 6c7276d7..d706797e 100644 --- a/src/api2/admin/datastore.rs +++ b/src/api2/admin/datastore.rs @@ -1,7 +1,7 @@ use failure::*; -use crate::api::schema::*; -use crate::api::router::*; +use crate::api_schema::schema::*; +use crate::api_schema::router::*; //use crate::server::rest::*; use serde_json::{json, Value}; diff --git a/src/api2/admin/datastore/catar.rs b/src/api2/admin/datastore/catar.rs index 3f235cad..bf910ef0 100644 --- a/src/api2/admin/datastore/catar.rs +++ b/src/api2/admin/datastore/catar.rs @@ -4,8 +4,8 @@ use crate::tools; use crate::tools::wrapped_reader_stream::*; use crate::backup::*; //use crate::server::rest::*; -use crate::api::schema::*; -use crate::api::router::*; +use crate::api_schema::schema::*; +use crate::api_schema::router::*; use chrono::{Utc, TimeZone}; diff --git a/src/api2/config.rs b/src/api2/config.rs index 30eca969..10d00ef0 100644 --- a/src/api2/config.rs +++ b/src/api2/config.rs @@ -1,8 +1,8 @@ //use failure::*; //use std::collections::HashMap; -use crate::api::schema::*; -use crate::api::router::*; +use crate::api_schema::schema::*; +use crate::api_schema::router::*; use serde_json::{json}; pub mod datastore; diff --git a/src/api2/config/datastore.rs b/src/api2/config/datastore.rs index cbde50be..ba096400 100644 --- a/src/api2/config/datastore.rs +++ b/src/api2/config/datastore.rs @@ -1,8 +1,8 @@ use failure::*; //use std::collections::HashMap; -use crate::api::schema::*; -use crate::api::router::*; +use crate::api_schema::schema::*; +use crate::api_schema::router::*; use crate::backup::*; use serde_json::{json, Value}; use std::path::PathBuf; diff --git a/src/api2/node.rs b/src/api2/node.rs index 6c3b13fc..a002bf72 100644 --- a/src/api2/node.rs +++ b/src/api2/node.rs @@ -1,5 +1,5 @@ -use crate::api::schema::*; -use crate::api::router::*; +use crate::api_schema::schema::*; +use crate::api_schema::router::*; use serde_json::{json}; mod time; diff --git a/src/api2/node/dns.rs b/src/api2/node/dns.rs index 5acec54a..e6a630c8 100644 --- a/src/api2/node/dns.rs +++ b/src/api2/node/dns.rs @@ -3,8 +3,8 @@ use failure::*; use crate::tools; use crate::api2::*; -//use crate::api::schema::*; -//use crate::api::router::*; +//use crate::api_schema::schema::*; +//use crate::api_schema::router::*; use lazy_static::lazy_static; diff --git a/src/api2/node/network.rs b/src/api2/node/network.rs index 3f22fe8d..799ad1df 100644 --- a/src/api2/node/network.rs +++ b/src/api2/node/network.rs @@ -1,8 +1,8 @@ use failure::*; //use crate::tools; -use crate::api::schema::*; -use crate::api::router::*; +use crate::api_schema::schema::*; +use crate::api_schema::router::*; use serde_json::{json, Value}; diff --git a/src/api2/node/services.rs b/src/api2/node/services.rs index a648f4fb..2330ec0a 100644 --- a/src/api2/node/services.rs +++ b/src/api2/node/services.rs @@ -1,8 +1,8 @@ use failure::*; use crate::tools; -use crate::api::schema::*; -use crate::api::router::*; +use crate::api_schema::schema::*; +use crate::api_schema::router::*; use serde_json::{json, Value}; use std::sync::Arc; diff --git a/src/api2/node/syslog.rs b/src/api2/node/syslog.rs index 1391686f..3fc68824 100644 --- a/src/api2/node/syslog.rs +++ b/src/api2/node/syslog.rs @@ -1,7 +1,7 @@ use failure::*; -use crate::api::schema::*; -use crate::api::router::*; +use crate::api_schema::schema::*; +use crate::api_schema::router::*; use serde_json::{json, Value}; use std::sync::Arc; diff --git a/src/api2/node/time.rs b/src/api2/node/time.rs index 0643d6d0..048091f9 100644 --- a/src/api2/node/time.rs +++ b/src/api2/node/time.rs @@ -1,8 +1,8 @@ use failure::*; use crate::tools; -use crate::api::schema::*; -use crate::api::router::*; +use crate::api_schema::schema::*; +use crate::api_schema::router::*; use serde_json::{json, Value}; use chrono::prelude::*; diff --git a/src/api2/subscription.rs b/src/api2/subscription.rs index ce9c1d21..2421a892 100644 --- a/src/api2/subscription.rs +++ b/src/api2/subscription.rs @@ -1,8 +1,8 @@ use failure::*; use crate::tools; -use crate::api::schema::*; -use crate::api::router::*; +use crate::api_schema::schema::*; +use crate::api_schema::router::*; use serde_json::{json, Value}; diff --git a/src/api2/version.rs b/src/api2/version.rs index 161bc1ae..4079dcc2 100644 --- a/src/api2/version.rs +++ b/src/api2/version.rs @@ -1,7 +1,7 @@ use failure::*; -use crate::api::schema::*; -use crate::api::router::*; +use crate::api_schema::schema::*; +use crate::api_schema::router::*; use serde_json::{json, Value}; const PROXMOX_PKG_VERSION: &'static str = env!("PROXMOX_PKG_VERSION"); diff --git a/src/api_schema.rs b/src/api_schema.rs new file mode 100644 index 00000000..1b7b09bc --- /dev/null +++ b/src/api_schema.rs @@ -0,0 +1,16 @@ +//! API definition helper +//! +//! This module contains helper classes to define REST APIs. Method +//! parameters and return types are described using a +//! [Schema](schema/enum.Schema.html). +//! +//! The [Router](router/struct.Router.html) is used to define a +//! hierarchy of API entries, and provides ways to find an API +//! definition by path. + +#[macro_use] +pub mod schema; +pub mod registry; +#[macro_use] +pub mod router; +pub mod config; diff --git a/src/api/config.rs b/src/api_schema/config.rs similarity index 98% rename from src/api/config.rs rename to src/api_schema/config.rs index 2bb9e86e..e8ac4a4c 100644 --- a/src/api/config.rs +++ b/src/api_schema/config.rs @@ -1,4 +1,4 @@ -use crate::api::router::*; +use crate::api_schema::router::*; use std::collections::HashMap; use std::path::{PathBuf}; diff --git a/src/api/registry.rs b/src/api_schema/registry.rs similarity index 98% rename from src/api/registry.rs rename to src/api_schema/registry.rs index a58562dd..4a4e9225 100644 --- a/src/api/registry.rs +++ b/src/api_schema/registry.rs @@ -1,4 +1,4 @@ -use crate::api::schema::*; +use crate::api_schema::schema::*; use failure::*; use std::collections::HashMap; diff --git a/src/api/router.rs b/src/api_schema/router.rs similarity index 99% rename from src/api/router.rs rename to src/api_schema/router.rs index 01a71dba..2c22606c 100644 --- a/src/api/router.rs +++ b/src/api_schema/router.rs @@ -1,6 +1,6 @@ use failure::*; -use crate::api::schema::*; +use crate::api_schema::schema::*; use serde_json::{Value}; use std::collections::HashMap; use std::sync::Arc; diff --git a/src/api/schema.rs b/src/api_schema/schema.rs similarity index 100% rename from src/api/schema.rs rename to src/api_schema/schema.rs diff --git a/src/bin/catar.rs b/src/bin/catar.rs index 74d24d97..53485076 100644 --- a/src/bin/catar.rs +++ b/src/bin/catar.rs @@ -4,8 +4,8 @@ use failure::*; use proxmox_backup::tools; use proxmox_backup::cli::command::*; -use proxmox_backup::api::schema::*; -use proxmox_backup::api::router::*; +use proxmox_backup::api_schema::schema::*; +use proxmox_backup::api_schema::router::*; use serde_json::{Value}; diff --git a/src/bin/proxmox-backup-api.rs b/src/bin/proxmox-backup-api.rs index 29ab6d6b..22e35b2e 100644 --- a/src/bin/proxmox-backup-api.rs +++ b/src/bin/proxmox-backup-api.rs @@ -1,8 +1,8 @@ extern crate proxmox_backup; //use proxmox_backup::tools; -use proxmox_backup::api::router::*; -use proxmox_backup::api::config::*; +use proxmox_backup::api_schema::router::*; +use proxmox_backup::api_schema::config::*; use proxmox_backup::server::rest::*; use proxmox_backup::auth_helpers::*; use proxmox_backup::config; diff --git a/src/bin/proxmox-backup-client.rs b/src/bin/proxmox-backup-client.rs index 48030dfd..92dff600 100644 --- a/src/bin/proxmox-backup-client.rs +++ b/src/bin/proxmox-backup-client.rs @@ -5,8 +5,8 @@ use failure::*; use proxmox_backup::tools; use proxmox_backup::cli::command::*; -use proxmox_backup::api::schema::*; -use proxmox_backup::api::router::*; +use proxmox_backup::api_schema::schema::*; +use proxmox_backup::api_schema::router::*; use proxmox_backup::client::*; //use proxmox_backup::backup::chunk_store::*; //use proxmox_backup::backup::image_index::*; diff --git a/src/bin/proxmox-backup-proxy.rs b/src/bin/proxmox-backup-proxy.rs index 7eca6f17..38b9ac69 100644 --- a/src/bin/proxmox-backup-proxy.rs +++ b/src/bin/proxmox-backup-proxy.rs @@ -2,8 +2,8 @@ extern crate proxmox_backup; use proxmox_backup::tools; -use proxmox_backup::api::router::*; -use proxmox_backup::api::config::*; +use proxmox_backup::api_schema::router::*; +use proxmox_backup::api_schema::config::*; use proxmox_backup::server::rest::*; use proxmox_backup::auth_helpers::*; diff --git a/src/cli/command.rs b/src/cli/command.rs index e31bbeb8..973f4eed 100644 --- a/src/cli/command.rs +++ b/src/cli/command.rs @@ -4,9 +4,9 @@ use std::collections::HashSet; use serde_json::Value; -use crate::api::schema::*; -use crate::api::router::*; -//use crate::api::config::*; +use crate::api_schema::schema::*; +use crate::api_schema::router::*; +//use crate::api_schema::config::*; use super::environment::CliEnvironment; use crate::getopts; diff --git a/src/cli/environment.rs b/src/cli/environment.rs index cd4179d8..183c02dd 100644 --- a/src/cli/environment.rs +++ b/src/cli/environment.rs @@ -1,4 +1,4 @@ -use crate::api::router::*; +use crate::api_schema::router::*; use std::collections::HashMap; use serde_json::Value; diff --git a/src/client/backup_repo.rs b/src/client/backup_repo.rs index 24d27380..caef0a66 100644 --- a/src/client/backup_repo.rs +++ b/src/client/backup_repo.rs @@ -1,6 +1,6 @@ use failure::*; -use crate::api::schema::*; +use crate::api_schema::schema::*; use std::sync::Arc; use lazy_static::lazy_static; diff --git a/src/config/datastore.rs b/src/config/datastore.rs index 0098dca7..26dc9e4b 100644 --- a/src/config/datastore.rs +++ b/src/config/datastore.rs @@ -5,7 +5,7 @@ use std::io::Read; //use std::sync::Arc; use crate::tools; -use crate::api::schema::*; +use crate::api_schema::schema::*; use crate::section_config::*; diff --git a/src/getopts.rs b/src/getopts.rs index 1293deec..6e742fe7 100644 --- a/src/getopts.rs +++ b/src/getopts.rs @@ -1,4 +1,4 @@ -use crate::api::schema::*; +use crate::api_schema::schema::*; use failure::*; diff --git a/src/lib.rs b/src/lib.rs index b6f85f7b..9bc6994a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,26 +4,8 @@ pub mod buildcfg; #[macro_use] pub mod tools; -/// API definition helper -/// -/// This module contains helper classes to define REST APIs. Method -/// parameters and return types are described using a -/// [Schema](schema/enum.Schema.html). -/// -/// The [Router](router/struct.Router.html) is used to define a -/// hierarchy of API entries, and provides ways to find an API -/// definition by path. - #[macro_use] -pub mod api { - - #[macro_use] - pub mod schema; - pub mod registry; - #[macro_use] - pub mod router; - pub mod config; -} +pub mod api_schema; #[macro_use] pub mod server { diff --git a/src/section_config.rs b/src/section_config.rs index 8f552977..a1031851 100644 --- a/src/section_config.rs +++ b/src/section_config.rs @@ -7,7 +7,7 @@ use std::collections::VecDeque; use serde_json::{json, Value}; use std::sync::Arc; -use crate::api::schema::*; +use crate::api_schema::schema::*; pub struct SectionConfigPlugin { type_name: String, diff --git a/src/server/environment.rs b/src/server/environment.rs index 2d6103f8..36bbcd9a 100644 --- a/src/server/environment.rs +++ b/src/server/environment.rs @@ -1,4 +1,4 @@ -use crate::api::router::*; +use crate::api_schema::router::*; use std::collections::HashMap; use serde_json::Value; diff --git a/src/server/formatter.rs b/src/server/formatter.rs index c46fc822..a4b89888 100644 --- a/src/server/formatter.rs +++ b/src/server/formatter.rs @@ -1,7 +1,7 @@ use failure::*; use serde_json::{json, Value}; -use crate::api::router::RpcEnvironment; +use crate::api_schema::router::RpcEnvironment; use hyper::{Body, Response, StatusCode}; use hyper::header; diff --git a/src/server/rest.rs b/src/server/rest.rs index 5d0f8249..ec64824a 100644 --- a/src/server/rest.rs +++ b/src/server/rest.rs @@ -1,7 +1,7 @@ use crate::tools; -use crate::api::schema::*; -use crate::api::router::*; -use crate::api::config::*; +use crate::api_schema::schema::*; +use crate::api_schema::router::*; +use crate::api_schema::config::*; use crate::auth_helpers::*; use super::environment::RestEnvironment; use super::formatter::*; diff --git a/src/storage/config.rs b/src/storage/config.rs index 1d294c04..9c1be18e 100644 --- a/src/storage/config.rs +++ b/src/storage/config.rs @@ -1,6 +1,6 @@ use failure::*; -use crate::api::schema::*; +use crate::api_schema::schema::*; use crate::section_config::*; use lazy_static::lazy_static;