src/api2.rs: move backup api to /backup

This commit is contained in:
Dietmar Maurer 2019-06-05 07:23:21 +02:00
parent 97eeea3b4a
commit 7773ccc11f
8 changed files with 9 additions and 9 deletions

View File

@ -1,6 +1,7 @@
pub mod types; pub mod types;
pub mod config; pub mod config;
pub mod admin; pub mod admin;
pub mod backup;
pub mod node; pub mod node;
mod version; mod version;
mod subscription; mod subscription;
@ -16,6 +17,7 @@ pub fn router() -> Router {
let route = Router::new() let route = Router::new()
.subdir("access", access::router()) .subdir("access", access::router())
.subdir("admin", admin::router()) .subdir("admin", admin::router())
.subdir("backup", backup::router())
.subdir("config", config::router()) .subdir("config", config::router())
.subdir("nodes", nodes) .subdir("nodes", nodes)
.subdir("subscription", subscription::router()) .subdir("subscription", subscription::router())

View File

@ -20,7 +20,6 @@ use crate::server::WorkerTask;
mod pxar; mod pxar;
mod upload; mod upload;
pub mod backup;
fn group_backups(backup_list: Vec<BackupInfo>) -> HashMap<String, Vec<BackupInfo>> { fn group_backups(backup_list: Vec<BackupInfo>) -> HashMap<String, Vec<BackupInfo>> {
@ -393,10 +392,6 @@ pub fn router() -> Router {
"test-upload", "test-upload",
Router::new() Router::new()
.upgrade(upload::api_method_upgrade_upload())) .upgrade(upload::api_method_upgrade_upload()))
.subdir(
"backup",
Router::new()
.upgrade(backup::api_method_upgrade_backup()))
.subdir( .subdir(
"gc", "gc",
Router::new() Router::new()

View File

@ -26,6 +26,10 @@ use service::*;
mod upload_chunk; mod upload_chunk;
use upload_chunk::*; use upload_chunk::*;
pub fn router() -> Router {
Router::new()
.upgrade(api_method_upgrade_backup())
}
pub fn api_method_upgrade_backup() -> ApiAsyncMethod { pub fn api_method_upgrade_backup() -> ApiAsyncMethod {
ApiAsyncMethod::new( ApiAsyncMethod::new(

View File

@ -5,7 +5,7 @@ use proxmox_backup::api_schema::format::*;
fn main() -> Result<(), Error> { fn main() -> Result<(), Error> {
let api = api2::admin::datastore::backup::backup_api(); let api = api2::backup::backup_api();
dump_api(&mut std::io::stdout(), &api, ".", 0)?; dump_api(&mut std::io::stdout(), &api, ".", 0)?;

View File

@ -258,9 +258,8 @@ impl HttpClient {
debug: bool, debug: bool,
) -> impl Future<Item=BackupClient, Error=Error> { ) -> impl Future<Item=BackupClient, Error=Error> {
let path = format!("/api2/json/admin/datastore/{}/backup", datastore); let param = json!({"backup-type": backup_type, "backup-id": backup_id, "store": datastore, "debug": debug});
let param = json!({"backup-type": backup_type, "backup-id": backup_id, "debug": debug}); let mut req = Self::request_builder(&self.server, "GET", "/api2/json/backup", Some(param)).unwrap();
let mut req = Self::request_builder(&self.server, "GET", &path, Some(param)).unwrap();
let login = self.auth.listen(); let login = self.auth.listen();