]>
Commit | Line | Data |
---|---|---|
6ce50400 DM |
1 | use failure::*; |
2 | ||
3 | use crate::api::schema::*; | |
4 | use crate::api::router::*; | |
5 | use serde_json::{json, Value}; | |
6 | ||
7 | const PROXMOX_PKG_VERSION: &'static str = env!("PROXMOX_PKG_VERSION"); | |
8 | const PROXMOX_PKG_RELEASE: &'static str = env!("PROXMOX_PKG_RELEASE"); | |
9 | const PROXMOX_PKG_REPOID: &'static str = env!("PROXMOX_PKG_REPOID"); | |
10 | ||
11 | fn get_version(_param: Value, _info: &ApiMethod) -> Result<Value, Error> { | |
12 | ||
13 | Ok(json!({ | |
14 | "version": PROXMOX_PKG_VERSION, | |
15 | "release": PROXMOX_PKG_RELEASE, | |
16 | "repoid": PROXMOX_PKG_REPOID | |
17 | })) | |
18 | } | |
19 | ||
20 | pub fn router() -> Router { | |
21 | ||
22 | let route = Router::new() | |
23 | .get(ApiMethod::new( | |
24 | get_version, | |
25 | ObjectSchema::new("Proxmox Backup Server API version."))); | |
26 | ||
27 | route | |
28 | } |