]> git.proxmox.com Git - proxmox-backup.git/blob - src/api2/ping.rs
update to first proxmox crate split
[proxmox-backup.git] / src / api2 / ping.rs
1 //! Cheap check if the API daemon is online.
2
3 use anyhow::{Error};
4 use serde_json::{json, Value};
5
6 use proxmox_router::{Router, Permission};
7 use proxmox_schema::api;
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 }`
26 pub fn ping() -> Result<Value, Error> {
27 Ok(json!({
28 "pong": true,
29 }))
30 }
31 pub const ROUTER: Router = Router::new()
32 .get(&API_METHOD_PING);