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