]>
Commit | Line | Data |
---|---|---|
bf78f708 DM |
1 | //! Cheap check if the API daemon is online. |
2 | ||
eed1bae5 TL |
3 | use anyhow::{Error}; |
4 | use serde_json::{json, Value}; | |
5 | ||
6ef1b649 WB |
6 | use proxmox_router::{Router, Permission}; |
7 | use proxmox_schema::api; | |
eed1bae5 TL |
8 | |
9 | #[api( | |
10 | returns: { | |
11 | description: "Dummy ping", | |
12 | type: Object, | |
13 | properties: { | |
14 | pong: { | |
15 | description: "Always true", | |
16 | type: bool, | |
17 | } | |
18 | } | |
19 | }, | |
20 | access: { | |
21 | description: "Anyone can access this, because it's used for a cheap check if the API daemon is online.", | |
22 | permission: &Permission::World, | |
23 | } | |
24 | )] | |
25 | /// Dummy method which replies with `{ "pong": True }` | |
bf78f708 | 26 | pub fn ping() -> Result<Value, Error> { |
eed1bae5 TL |
27 | Ok(json!({ |
28 | "pong": true, | |
29 | })) | |
30 | } | |
31 | pub const ROUTER: Router = Router::new() | |
32 | .get(&API_METHOD_PING); |