2018-12-08 13:44:55 +00:00
|
|
|
use failure::*;
|
|
|
|
|
2019-02-17 09:16:33 +00:00
|
|
|
use crate::api_schema::*;
|
2019-02-17 08:59:20 +00:00
|
|
|
use crate::api_schema::router::*;
|
2018-12-08 13:44:55 +00:00
|
|
|
use serde_json::{json, Value};
|
|
|
|
|
2019-10-26 09:36:01 +00:00
|
|
|
pub const PROXMOX_PKG_VERSION: &str =
|
2019-09-09 08:51:08 +00:00
|
|
|
concat!(
|
|
|
|
env!("CARGO_PKG_VERSION_MAJOR"),
|
|
|
|
".",
|
|
|
|
env!("CARGO_PKG_VERSION_MINOR"),
|
|
|
|
);
|
2019-10-26 09:36:01 +00:00
|
|
|
pub const PROXMOX_PKG_RELEASE: &str = env!("CARGO_PKG_VERSION_PATCH");
|
|
|
|
pub const PROXMOX_PKG_REPOID: &str = env!("CARGO_PKG_REPOSITORY");
|
2018-12-08 13:44:55 +00:00
|
|
|
|
2019-01-26 13:50:37 +00:00
|
|
|
fn get_version(
|
|
|
|
_param: Value,
|
|
|
|
_info: &ApiMethod,
|
2019-06-07 11:10:56 +00:00
|
|
|
_rpcenv: &mut dyn RpcEnvironment,
|
2019-01-26 13:50:37 +00:00
|
|
|
) -> Result<Value, Error> {
|
2018-12-08 13:44:55 +00:00
|
|
|
|
|
|
|
Ok(json!({
|
|
|
|
"version": PROXMOX_PKG_VERSION,
|
|
|
|
"release": PROXMOX_PKG_RELEASE,
|
|
|
|
"repoid": PROXMOX_PKG_REPOID
|
|
|
|
}))
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn router() -> Router {
|
2019-10-26 09:36:01 +00:00
|
|
|
Router::new()
|
2018-12-08 13:44:55 +00:00
|
|
|
.get(ApiMethod::new(
|
|
|
|
get_version,
|
2019-10-26 09:36:01 +00:00
|
|
|
ObjectSchema::new("Proxmox Backup Server API version.")))
|
2018-12-08 13:44:55 +00:00
|
|
|
}
|