bf78f70885
Note: API methos should be declared pub, so that they show up in the generated docu.
32 lines
756 B
Rust
32 lines
756 B
Rust
//! Cheap check if the API daemon is online.
|
|
|
|
use anyhow::{Error};
|
|
use serde_json::{json, Value};
|
|
|
|
use proxmox::api::{api, Router, Permission};
|
|
|
|
#[api(
|
|
returns: {
|
|
description: "Dummy ping",
|
|
type: Object,
|
|
properties: {
|
|
pong: {
|
|
description: "Always true",
|
|
type: bool,
|
|
}
|
|
}
|
|
},
|
|
access: {
|
|
description: "Anyone can access this, because it's used for a cheap check if the API daemon is online.",
|
|
permission: &Permission::World,
|
|
}
|
|
)]
|
|
/// Dummy method which replies with `{ "pong": True }`
|
|
pub fn ping() -> Result<Value, Error> {
|
|
Ok(json!({
|
|
"pong": true,
|
|
}))
|
|
}
|
|
pub const ROUTER: Router = Router::new()
|
|
.get(&API_METHOD_PING);
|