2021-01-22 14:53:51 +00:00
|
|
|
//! Version information
|
|
|
|
|
2020-04-17 12:11:25 +00:00
|
|
|
use anyhow::{Error};
|
2018-12-08 13:44:55 +00:00
|
|
|
use serde_json::{json, Value};
|
|
|
|
|
2021-10-08 09:19:37 +00:00
|
|
|
use proxmox_router::{ApiHandler, ApiMethod, Router, RpcEnvironment, Permission};
|
|
|
|
use proxmox_schema::ObjectSchema;
|
2019-11-21 13:36:28 +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!({
|
2021-07-19 12:59:17 +00:00
|
|
|
"version": pbs_buildcfg::PROXMOX_PKG_VERSION,
|
|
|
|
"release": pbs_buildcfg::PROXMOX_PKG_RELEASE,
|
|
|
|
"repoid": pbs_buildcfg::PROXMOX_PKG_REPOID
|
2018-12-08 13:44:55 +00:00
|
|
|
}))
|
|
|
|
}
|
|
|
|
|
2019-11-21 08:36:41 +00:00
|
|
|
pub const ROUTER: Router = Router::new()
|
|
|
|
.get(
|
|
|
|
&ApiMethod::new(
|
|
|
|
&ApiHandler::Sync(&get_version),
|
|
|
|
&ObjectSchema::new("Proxmox Backup Server API version.", &[])
|
2020-04-16 08:01:59 +00:00
|
|
|
).access(None, &Permission::Anybody)
|
2019-11-21 08:36:41 +00:00
|
|
|
);
|
|
|
|
|