]>
Commit | Line | Data |
---|---|---|
f7d4e4b5 | 1 | use anyhow::{Error}; |
6ce50400 DM |
2 | use serde_json::{json, Value}; |
3 | ||
4b40148c | 4 | use proxmox::api::{ApiHandler, ApiMethod, Router, RpcEnvironment, Permission}; |
a2479cfa WB |
5 | use proxmox::api::schema::ObjectSchema; |
6 | ||
62ee2eb4 | 7 | pub const PROXMOX_PKG_VERSION: &str = |
4a7de56e DM |
8 | concat!( |
9 | env!("CARGO_PKG_VERSION_MAJOR"), | |
10 | ".", | |
11 | env!("CARGO_PKG_VERSION_MINOR"), | |
12 | ); | |
62ee2eb4 DM |
13 | pub const PROXMOX_PKG_RELEASE: &str = env!("CARGO_PKG_VERSION_PATCH"); |
14 | pub const PROXMOX_PKG_REPOID: &str = env!("CARGO_PKG_REPOSITORY"); | |
6ce50400 | 15 | |
6049b71f DM |
16 | fn get_version( |
17 | _param: Value, | |
18 | _info: &ApiMethod, | |
dd5495d6 | 19 | _rpcenv: &mut dyn RpcEnvironment, |
6049b71f | 20 | ) -> Result<Value, Error> { |
6ce50400 DM |
21 | |
22 | Ok(json!({ | |
23 | "version": PROXMOX_PKG_VERSION, | |
24 | "release": PROXMOX_PKG_RELEASE, | |
25 | "repoid": PROXMOX_PKG_REPOID | |
26 | })) | |
27 | } | |
28 | ||
255f378a DM |
29 | pub const ROUTER: Router = Router::new() |
30 | .get( | |
31 | &ApiMethod::new( | |
32 | &ApiHandler::Sync(&get_version), | |
33 | &ObjectSchema::new("Proxmox Backup Server API version.", &[]) | |
4b40148c | 34 | ).access(None, &Permission::Anybody) |
255f378a DM |
35 | ); |
36 |