api2: nodes: add missing node list api call
to have an api call for api path traversal Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
36c6e7bb82
commit
957133077f
@ -18,14 +18,12 @@ use proxmox::api::router::SubdirMap;
|
||||
use proxmox::api::Router;
|
||||
use proxmox::list_subdirs_api_method;
|
||||
|
||||
const NODES_ROUTER: Router = Router::new().match_all("node", &node::ROUTER);
|
||||
|
||||
const SUBDIRS: SubdirMap = &[
|
||||
("access", &access::ROUTER),
|
||||
("admin", &admin::ROUTER),
|
||||
("backup", &backup::ROUTER),
|
||||
("config", &config::ROUTER),
|
||||
("nodes", &NODES_ROUTER),
|
||||
("nodes", &node::ROUTER),
|
||||
("ping", &ping::ROUTER),
|
||||
("pull", &pull::ROUTER),
|
||||
("reader", &reader::ROUTER),
|
||||
|
@ -315,6 +315,12 @@ fn upgrade_to_websocket(
|
||||
.boxed()
|
||||
}
|
||||
|
||||
#[api]
|
||||
/// List Nodes (only for compatiblity)
|
||||
fn list_nodes() -> Result<Value, Error> {
|
||||
Ok(json!([ { "node": proxmox::tools::nodename().to_string() } ]))
|
||||
}
|
||||
|
||||
pub const SUBDIRS: SubdirMap = &[
|
||||
("apt", &apt::ROUTER),
|
||||
("certificates", &certificates::ROUTER),
|
||||
@ -338,6 +344,10 @@ pub const SUBDIRS: SubdirMap = &[
|
||||
),
|
||||
];
|
||||
|
||||
pub const ROUTER: Router = Router::new()
|
||||
pub const ITEM_ROUTER: Router = Router::new()
|
||||
.get(&list_subdirs_api_method!(SUBDIRS))
|
||||
.subdirs(SUBDIRS);
|
||||
|
||||
pub const ROUTER: Router = Router::new()
|
||||
.get(&API_METHOD_LIST_NODES)
|
||||
.match_all("node", &ITEM_ROUTER);
|
||||
|
Loading…
Reference in New Issue
Block a user