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