proxmox-backup/src/api2/version.rs
Wolfgang Bumiller 6ef1b649d9 update to first proxmox crate split
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-10-11 11:58:49 +02:00

30 lines
752 B
Rust

//! Version information
use anyhow::{Error};
use serde_json::{json, Value};
use proxmox_router::{ApiHandler, ApiMethod, Router, RpcEnvironment, Permission};
use proxmox_schema::ObjectSchema;
fn get_version(
_param: Value,
_info: &ApiMethod,
_rpcenv: &mut dyn RpcEnvironment,
) -> Result<Value, Error> {
Ok(json!({
"version": pbs_buildcfg::PROXMOX_PKG_VERSION,
"release": pbs_buildcfg::PROXMOX_PKG_RELEASE,
"repoid": pbs_buildcfg::PROXMOX_PKG_REPOID
}))
}
pub const ROUTER: Router = Router::new()
.get(
&ApiMethod::new(
&ApiHandler::Sync(&get_version),
&ObjectSchema::new("Proxmox Backup Server API version.", &[])
).access(None, &Permission::Anybody)
);