test another api macro use
The api macro now supports hyphens in parameter names and referencing externally defined `Schema`s, so here's an example. Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
de0aa53174
commit
a9aa52e6a8
|
@ -6,7 +6,7 @@ use hyper::{Body, Response, StatusCode};
|
||||||
use serde_json::{json, Value};
|
use serde_json::{json, Value};
|
||||||
|
|
||||||
use proxmox::{sortable, identity};
|
use proxmox::{sortable, identity};
|
||||||
use proxmox::api::list_subdirs_api_method;
|
use proxmox::api::{api, list_subdirs_api_method};
|
||||||
use proxmox::api::{ApiFuture, ApiHandler, ApiMethod, Router, RpcEnvironment};
|
use proxmox::api::{ApiFuture, ApiHandler, ApiMethod, Router, RpcEnvironment};
|
||||||
use proxmox::api::router::SubdirMap;
|
use proxmox::api::router::SubdirMap;
|
||||||
use proxmox::api::schema::*;
|
use proxmox::api::schema::*;
|
||||||
|
@ -216,20 +216,18 @@ pub const BACKUP_API_ROUTER: Router = Router::new()
|
||||||
.get(&list_subdirs_api_method!(BACKUP_API_SUBDIRS))
|
.get(&list_subdirs_api_method!(BACKUP_API_SUBDIRS))
|
||||||
.subdirs(BACKUP_API_SUBDIRS);
|
.subdirs(BACKUP_API_SUBDIRS);
|
||||||
|
|
||||||
#[sortable]
|
#[api(
|
||||||
pub const API_METHOD_CREATE_DYNAMIC_INDEX: ApiMethod = ApiMethod::new(
|
input: {
|
||||||
&ApiHandler::Sync(&create_dynamic_index),
|
properties: {
|
||||||
&ObjectSchema::new(
|
"archive-name": {
|
||||||
"Create dynamic chunk index file.",
|
schema: crate::api2::types::BACKUP_ARCHIVE_NAME_SCHEMA,
|
||||||
&sorted!([
|
},
|
||||||
("archive-name", false, &crate::api2::types::BACKUP_ARCHIVE_NAME_SCHEMA),
|
},
|
||||||
]),
|
},
|
||||||
)
|
)]
|
||||||
);
|
/// Create dynamic chunk index file.
|
||||||
|
|
||||||
fn create_dynamic_index(
|
fn create_dynamic_index(
|
||||||
param: Value,
|
param: Value,
|
||||||
_info: &ApiMethod,
|
|
||||||
rpcenv: &mut dyn RpcEnvironment,
|
rpcenv: &mut dyn RpcEnvironment,
|
||||||
) -> Result<Value, Error> {
|
) -> Result<Value, Error> {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue