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
2019-01-22 12:10:38 +01:00
parent b0ee976fbf
commit 576e3bf252
14 changed files with 14 additions and 156 deletions

28
src/api2/version.rs Normal file
View File

@ -0,0 +1,28 @@
use failure::*;
use crate::api::schema::*;
use crate::api::router::*;
use serde_json::{json, Value};
const PROXMOX_PKG_VERSION: &'static str = env!("PROXMOX_PKG_VERSION");
const PROXMOX_PKG_RELEASE: &'static str = env!("PROXMOX_PKG_RELEASE");
const PROXMOX_PKG_REPOID: &'static str = env!("PROXMOX_PKG_REPOID");
fn get_version(_param: Value, _info: &ApiMethod) -> Result<Value, Error> {
Ok(json!({
"version": PROXMOX_PKG_VERSION,
"release": PROXMOX_PKG_RELEASE,
"repoid": PROXMOX_PKG_REPOID
}))
}
pub fn router() -> Router {
let route = Router::new()
.get(ApiMethod::new(
get_version,
ObjectSchema::new("Proxmox Backup Server API version.")));
route
}