rename api3 back to api2

There is no real need to change the path, so using api2 we can reuse
all helpers (like tools from proxmox widget toolkit).
This commit is contained in:
Dietmar Maurer committed 2019-01-22 12:10:38 +01:00
1 parent b0ee976fbf
commit 576e3bf252
14 files changed
+14 -156

No files matched your search

+1 -1
View File
@@ -67,7 +67,7 @@ fn main() {
let addr = ([0,0,0,0,0,0,0,0], 8007).into();
lazy_static!{
static ref ROUTER: Router = proxmox_backup::api3::router();
static ref ROUTER: Router = proxmox_backup::api2::router();
}
let mut config = ApiConfig::new("/usr/share/javascript/proxmox-backup", &ROUTER);
+2 -2
View File
@@ -32,7 +32,7 @@ fn backup_directory(body: Body, store: &str, archive_name: &str) -> Result<(), E
.append_pair("time", &epoch.to_string())
.finish();
let path = format!("api3/json/admin/datastore/{}/catar?{}", store, query);
let path = format!("api2/json/admin/datastore/{}/catar?{}", store, query);
client.upload("application/x-proxmox-backup-catar", body, &path)?;
@@ -71,7 +71,7 @@ fn list_backups(param: Value, _info: &ApiMethod) -> Result<Value, Error> {
let client = HttpClient::new("localhost");
let path = format!("api3/json/admin/datastore/{}/backups", store);
let path = format!("api2/json/admin/datastore/{}/backups", store);
let result = client.get(&path)?;
+8 -8
View File
@@ -1,21 +1,21 @@
extern crate proxmox_backup;
//use proxmox_backup::api3;
//use proxmox_backup::api2;
use proxmox_backup::cli::command::*;
fn datastore_commands() -> CommandLineInterface {
use proxmox_backup::config;
use proxmox_backup::api3;
use proxmox_backup::api2;
let cmd_def = CliCommandMap::new()
.insert("list", CliCommand::new(api3::config::datastore::get()).into())
.insert("list", CliCommand::new(api2::config::datastore::get()).into())
.insert("create",
CliCommand::new(api3::config::datastore::post())
CliCommand::new(api2::config::datastore::post())
.arg_param(vec!["name", "path"])
.into())
.insert("remove",
CliCommand::new(api3::config::datastore::delete())
CliCommand::new(api2::config::datastore::delete())
.arg_param(vec!["name"])
.completion_cb("name", config::datastore::complete_datastore_name)
.into());
@@ -28,16 +28,16 @@ fn datastore_commands() -> CommandLineInterface {
fn garbage_collection_commands() -> CommandLineInterface {
use proxmox_backup::config;
use proxmox_backup::api3;
use proxmox_backup::api2;
let cmd_def = CliCommandMap::new()
.insert("status",
CliCommand::new(api3::admin::datastore::api_method_garbage_collection_status())
CliCommand::new(api2::admin::datastore::api_method_garbage_collection_status())
.arg_param(vec!["name"])
.completion_cb("name", config::datastore::complete_datastore_name)
.into())
.insert("start",
CliCommand::new(api3::admin::datastore::api_method_start_garbage_collection())
CliCommand::new(api2::admin::datastore::api_method_start_garbage_collection())
.arg_param(vec!["name"])
.completion_cb("name", config::datastore::complete_datastore_name)
.into());