]>
Commit | Line | Data |
---|---|---|
6ce50400 DM |
1 | use failure::*; |
2 | ||
ef2f2efb | 3 | use crate::api_schema::*; |
dc9a007b | 4 | use crate::api_schema::router::*; |
6ce50400 DM |
5 | use serde_json::{json, Value}; |
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.", &[]) | |
34 | ) | |
35 | ); | |
36 |