adaptions for proxmox 0.9 and proxmox-api-macro 0.3
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
54d968664a
commit
b2362a1207
@ -15,7 +15,7 @@ use proxmox::api::{
|
||||
api, ApiResponseFuture, ApiHandler, ApiMethod, Router,
|
||||
RpcEnvironment, RpcEnvironmentType, Permission
|
||||
};
|
||||
use proxmox::api::router::SubdirMap;
|
||||
use proxmox::api::router::{ReturnType, SubdirMap};
|
||||
use proxmox::api::schema::*;
|
||||
use proxmox::tools::fs::{replace_file, CreateOptions};
|
||||
use proxmox::{http_err, identity, list_subdirs_api_method, sortable};
|
||||
@ -148,7 +148,7 @@ fn get_all_snapshot_files(
|
||||
},
|
||||
)]
|
||||
/// List backup groups.
|
||||
fn list_groups(
|
||||
pub fn list_groups(
|
||||
store: String,
|
||||
rpcenv: &mut dyn RpcEnvironment,
|
||||
) -> Result<Vec<GroupListItem>, Error> {
|
||||
@ -772,7 +772,7 @@ pub const API_RETURN_SCHEMA_PRUNE: Schema = ArraySchema::new(
|
||||
&PruneListItem::API_SCHEMA
|
||||
).schema();
|
||||
|
||||
const API_METHOD_PRUNE: ApiMethod = ApiMethod::new(
|
||||
pub const API_METHOD_PRUNE: ApiMethod = ApiMethod::new(
|
||||
&ApiHandler::Sync(&prune),
|
||||
&ObjectSchema::new(
|
||||
"Prune the datastore.",
|
||||
@ -787,7 +787,7 @@ const API_METHOD_PRUNE: ApiMethod = ApiMethod::new(
|
||||
("store", false, &DATASTORE_SCHEMA),
|
||||
])
|
||||
))
|
||||
.returns(&API_RETURN_SCHEMA_PRUNE)
|
||||
.returns(ReturnType::new(false, &API_RETURN_SCHEMA_PRUNE))
|
||||
.access(None, &Permission::Privilege(
|
||||
&["datastore", "{store}"],
|
||||
PRIV_DATASTORE_MODIFY | PRIV_DATASTORE_PRUNE,
|
||||
|
@ -412,9 +412,9 @@ async fn list_backup_groups(param: Value) -> Result<Value, Error> {
|
||||
|
||||
let mut data: Value = result["data"].take();
|
||||
|
||||
let info = &proxmox_backup::api2::admin::datastore::API_RETURN_SCHEMA_LIST_GROUPS;
|
||||
let return_type = &proxmox_backup::api2::admin::datastore::API_METHOD_LIST_GROUPS.returns;
|
||||
|
||||
format_and_print_result_full(&mut data, info, &output_format, &options);
|
||||
format_and_print_result_full(&mut data, return_type, &output_format, &options);
|
||||
|
||||
Ok(Value::Null)
|
||||
}
|
||||
@ -1458,7 +1458,7 @@ async fn prune_async(mut param: Value) -> Result<Value, Error> {
|
||||
.column(ColumnConfig::new("keep").renderer(render_prune_action).header("action"))
|
||||
;
|
||||
|
||||
let info = &proxmox_backup::api2::admin::datastore::API_RETURN_SCHEMA_PRUNE;
|
||||
let return_type = &proxmox_backup::api2::admin::datastore::API_METHOD_PRUNE.returns;
|
||||
|
||||
let mut data = result["data"].take();
|
||||
|
||||
@ -1469,7 +1469,7 @@ async fn prune_async(mut param: Value) -> Result<Value, Error> {
|
||||
data = list.into();
|
||||
}
|
||||
|
||||
format_and_print_result_full(&mut data, info, &output_format, &options);
|
||||
format_and_print_result_full(&mut data, return_type, &output_format, &options);
|
||||
|
||||
Ok(Value::Null)
|
||||
}
|
||||
@ -1522,9 +1522,9 @@ async fn status(param: Value) -> Result<Value, Error> {
|
||||
.column(ColumnConfig::new("used").renderer(render_total_percentage))
|
||||
.column(ColumnConfig::new("avail").renderer(render_total_percentage));
|
||||
|
||||
let schema = &API_RETURN_SCHEMA_STATUS;
|
||||
let return_type = &API_METHOD_STATUS.returns;
|
||||
|
||||
format_and_print_result_full(&mut data, schema, &output_format, &options);
|
||||
format_and_print_result_full(&mut data, return_type, &output_format, &options);
|
||||
|
||||
Ok(Value::Null)
|
||||
}
|
||||
|
@ -106,11 +106,11 @@ async fn garbage_collection_status(param: Value) -> Result<Value, Error> {
|
||||
|
||||
let mut result = client.get(&path, None).await?;
|
||||
let mut data = result["data"].take();
|
||||
let schema = &api2::admin::datastore::API_RETURN_SCHEMA_GARBAGE_COLLECTION_STATUS;
|
||||
let return_type = &api2::admin::datastore::API_METHOD_GARBAGE_COLLECTION_STATUS.returns;
|
||||
|
||||
let options = default_table_format_options();
|
||||
|
||||
format_and_print_result_full(&mut data, schema, &output_format, &options);
|
||||
format_and_print_result_full(&mut data, return_type, &output_format, &options);
|
||||
|
||||
Ok(Value::Null)
|
||||
}
|
||||
@ -172,7 +172,7 @@ async fn task_list(param: Value) -> Result<Value, Error> {
|
||||
let mut result = client.get("api2/json/nodes/localhost/tasks", Some(args)).await?;
|
||||
|
||||
let mut data = result["data"].take();
|
||||
let schema = &api2::node::tasks::API_RETURN_SCHEMA_LIST_TASKS;
|
||||
let return_type = &api2::node::tasks::API_METHOD_LIST_TASKS.returns;
|
||||
|
||||
let options = default_table_format_options()
|
||||
.column(ColumnConfig::new("starttime").right_align(false).renderer(tools::format::render_epoch))
|
||||
@ -180,7 +180,7 @@ async fn task_list(param: Value) -> Result<Value, Error> {
|
||||
.column(ColumnConfig::new("upid"))
|
||||
.column(ColumnConfig::new("status").renderer(tools::format::render_task_status));
|
||||
|
||||
format_and_print_result_full(&mut data, schema, &output_format, &options);
|
||||
format_and_print_result_full(&mut data, return_type, &output_format, &options);
|
||||
|
||||
Ok(Value::Null)
|
||||
}
|
||||
@ -370,9 +370,9 @@ async fn get_versions(verbose: bool, param: Value) -> Result<Value, Error> {
|
||||
.column(ColumnConfig::new("Version"))
|
||||
.column(ColumnConfig::new("ExtraInfo").header("Extra Info"))
|
||||
;
|
||||
let schema = &crate::api2::node::apt::API_RETURN_SCHEMA_GET_VERSIONS;
|
||||
let return_type = &crate::api2::node::apt::API_METHOD_GET_VERSIONS.returns;
|
||||
|
||||
format_and_print_result_full(&mut packages, schema, &output_format, &options);
|
||||
format_and_print_result_full(&mut packages, return_type, &output_format, &options);
|
||||
|
||||
Ok(Value::Null)
|
||||
}
|
||||
|
@ -313,7 +313,7 @@ async fn read_label(
|
||||
.column(ColumnConfig::new("media-set-ctime").renderer(render_epoch))
|
||||
;
|
||||
|
||||
format_and_print_result_full(&mut data, info.returns, &output_format, &options);
|
||||
format_and_print_result_full(&mut data, &info.returns, &output_format, &options);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@ -385,7 +385,7 @@ async fn inventory(
|
||||
.column(ColumnConfig::new("uuid"))
|
||||
;
|
||||
|
||||
format_and_print_result_full(&mut data, info.returns, &output_format, &options);
|
||||
format_and_print_result_full(&mut data, &info.returns, &output_format, &options);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ use proxmox::api::{
|
||||
format_and_print_result_full,
|
||||
default_table_format_options,
|
||||
},
|
||||
router::ReturnType,
|
||||
};
|
||||
|
||||
use proxmox_backup::backup::{
|
||||
@ -178,7 +179,7 @@ fn render_result(
|
||||
) -> Result<(), Error> {
|
||||
|
||||
let mut data = serde_json::to_value(benchmark_result)?;
|
||||
let schema = &BenchmarkResult::API_SCHEMA;
|
||||
let return_type = ReturnType::new(false, &BenchmarkResult::API_SCHEMA);
|
||||
|
||||
let render_speed = |value: &Value, _record: &Value| -> Result<String, Error> {
|
||||
match value["speed"].as_f64() {
|
||||
@ -211,7 +212,7 @@ fn render_result(
|
||||
.right_align(false).renderer(render_speed));
|
||||
|
||||
|
||||
format_and_print_result_full(&mut data, schema, output_format, &options);
|
||||
format_and_print_result_full(&mut data, &return_type, output_format, &options);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ use proxmox::api::cli::{
|
||||
get_output_format,
|
||||
OUTPUT_FORMAT,
|
||||
};
|
||||
use proxmox::api::router::ReturnType;
|
||||
use proxmox::sys::linux::tty;
|
||||
use proxmox::tools::fs::{file_get_contents, replace_file, CreateOptions};
|
||||
|
||||
@ -382,9 +383,14 @@ fn show_key(
|
||||
.column(ColumnConfig::new("modified").renderer(tools::format::render_epoch))
|
||||
.column(ColumnConfig::new("fingerprint"));
|
||||
|
||||
let schema = &KeyInfo::API_SCHEMA;
|
||||
let return_type = ReturnType::new(false, &KeyInfo::API_SCHEMA);
|
||||
|
||||
format_and_print_result_full(&mut serde_json::to_value(info)?, schema, &output_format, &options);
|
||||
format_and_print_result_full(
|
||||
&mut serde_json::to_value(info)?,
|
||||
&return_type,
|
||||
&output_format,
|
||||
&options,
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -97,9 +97,9 @@ async fn list_snapshots(param: Value) -> Result<Value, Error> {
|
||||
.column(ColumnConfig::new("files").renderer(render_files))
|
||||
;
|
||||
|
||||
let info = &proxmox_backup::api2::admin::datastore::API_RETURN_SCHEMA_LIST_SNAPSHOTS;
|
||||
let return_type = &proxmox_backup::api2::admin::datastore::API_METHOD_LIST_SNAPSHOTS.returns;
|
||||
|
||||
format_and_print_result_full(&mut data, info, &output_format, &options);
|
||||
format_and_print_result_full(&mut data, return_type, &output_format, &options);
|
||||
|
||||
Ok(Value::Null)
|
||||
}
|
||||
@ -144,13 +144,14 @@ async fn list_snapshot_files(param: Value) -> Result<Value, Error> {
|
||||
|
||||
record_repository(&repo);
|
||||
|
||||
let info = &proxmox_backup::api2::admin::datastore::API_RETURN_SCHEMA_LIST_SNAPSHOT_FILES;
|
||||
let return_type =
|
||||
&proxmox_backup::api2::admin::datastore::API_METHOD_LIST_SNAPSHOT_FILES.returns;
|
||||
|
||||
let mut data: Value = result["data"].take();
|
||||
|
||||
let options = default_table_format_options();
|
||||
|
||||
format_and_print_result_full(&mut data, info, &output_format, &options);
|
||||
format_and_print_result_full(&mut data, return_type, &output_format, &options);
|
||||
|
||||
Ok(Value::Null)
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ async fn task_list(param: Value) -> Result<Value, Error> {
|
||||
let mut result = client.get("api2/json/nodes/localhost/tasks", Some(args)).await?;
|
||||
let mut data = result["data"].take();
|
||||
|
||||
let schema = &proxmox_backup::api2::node::tasks::API_RETURN_SCHEMA_LIST_TASKS;
|
||||
let return_type = &proxmox_backup::api2::node::tasks::API_METHOD_LIST_TASKS.returns;
|
||||
|
||||
let options = default_table_format_options()
|
||||
.column(ColumnConfig::new("starttime").right_align(false).renderer(tools::format::render_epoch))
|
||||
@ -72,7 +72,7 @@ async fn task_list(param: Value) -> Result<Value, Error> {
|
||||
.column(ColumnConfig::new("upid"))
|
||||
.column(ColumnConfig::new("status").renderer(tools::format::render_task_status));
|
||||
|
||||
format_and_print_result_full(&mut data, schema, &output_format, &options);
|
||||
format_and_print_result_full(&mut data, return_type, &output_format, &options);
|
||||
|
||||
Ok(Value::Null)
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ fn list_acls(param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<Value, Err
|
||||
.column(ColumnConfig::new("propagate"))
|
||||
.column(ColumnConfig::new("roleid"));
|
||||
|
||||
format_and_print_result_full(&mut data, info.returns, &output_format, &options);
|
||||
format_and_print_result_full(&mut data, &info.returns, &output_format, &options);
|
||||
|
||||
Ok(Value::Null)
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ fn list_datastores(param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<Valu
|
||||
.column(ColumnConfig::new("path"))
|
||||
.column(ColumnConfig::new("comment"));
|
||||
|
||||
format_and_print_result_full(&mut data, info.returns, &output_format, &options);
|
||||
format_and_print_result_full(&mut data, &info.returns, &output_format, &options);
|
||||
|
||||
Ok(Value::Null)
|
||||
}
|
||||
@ -62,7 +62,7 @@ fn show_datastore(param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<Value
|
||||
};
|
||||
|
||||
let options = default_table_format_options();
|
||||
format_and_print_result_full(&mut data, info.returns, &output_format, &options);
|
||||
format_and_print_result_full(&mut data, &info.returns, &output_format, &options);
|
||||
|
||||
Ok(Value::Null)
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ fn list_disks(mut param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<Value
|
||||
.column(ColumnConfig::new("status"))
|
||||
;
|
||||
|
||||
format_and_print_result_full(&mut data, info.returns, &output_format, &options);
|
||||
format_and_print_result_full(&mut data, &info.returns, &output_format, &options);
|
||||
|
||||
Ok(Value::Null)
|
||||
}
|
||||
@ -100,7 +100,7 @@ fn smart_attributes(mut param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result
|
||||
let mut data = data["attributes"].take();
|
||||
|
||||
let options = default_table_format_options();
|
||||
format_and_print_result_full(&mut data, API_METHOD_SMART_ATTRIBUTES.returns, &output_format, &options);
|
||||
format_and_print_result_full(&mut data, &API_METHOD_SMART_ATTRIBUTES.returns, &output_format, &options);
|
||||
|
||||
Ok(Value::Null)
|
||||
}
|
||||
@ -227,7 +227,7 @@ fn list_zpools(mut param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<Valu
|
||||
.column(ColumnConfig::new("alloc").right_align(true).renderer(render_usage))
|
||||
.column(ColumnConfig::new("health"));
|
||||
|
||||
format_and_print_result_full(&mut data, info.returns, &output_format, &options);
|
||||
format_and_print_result_full(&mut data, &info.returns, &output_format, &options);
|
||||
|
||||
Ok(Value::Null)
|
||||
}
|
||||
@ -274,7 +274,7 @@ fn list_datastore_mounts(mut param: Value, rpcenv: &mut dyn RpcEnvironment) -> R
|
||||
.column(ColumnConfig::new("filesystem"))
|
||||
.column(ColumnConfig::new("options"));
|
||||
|
||||
format_and_print_result_full(&mut data, info.returns, &output_format, &options);
|
||||
format_and_print_result_full(&mut data, &info.returns, &output_format, &options);
|
||||
|
||||
Ok(Value::Null)
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ fn get_dns(mut param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<Value, E
|
||||
.column(ColumnConfig::new("dns2"))
|
||||
.column(ColumnConfig::new("dns3"));
|
||||
|
||||
format_and_print_result_full(&mut data, info.returns, &output_format, &options);
|
||||
format_and_print_result_full(&mut data, &info.returns, &output_format, &options);
|
||||
|
||||
Ok(Value::Null)
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ fn list_network_devices(mut param: Value, rpcenv: &mut dyn RpcEnvironment) -> Re
|
||||
.column(ColumnConfig::new("gateway").header("gateway").renderer(render_gateway))
|
||||
.column(ColumnConfig::new("bridge_ports").header("ports/slaves").renderer(render_ports));
|
||||
|
||||
format_and_print_result_full(&mut data, info.returns, &output_format, &options);
|
||||
format_and_print_result_full(&mut data, &info.returns, &output_format, &options);
|
||||
|
||||
Ok(Value::Null)
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ fn list_remotes(param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<Value,
|
||||
.column(ColumnConfig::new("fingerprint"))
|
||||
.column(ColumnConfig::new("comment"));
|
||||
|
||||
format_and_print_result_full(&mut data, info.returns, &output_format, &options);
|
||||
format_and_print_result_full(&mut data, &info.returns, &output_format, &options);
|
||||
|
||||
Ok(Value::Null)
|
||||
}
|
||||
@ -64,7 +64,7 @@ fn show_remote(param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<Value, E
|
||||
};
|
||||
|
||||
let options = default_table_format_options();
|
||||
format_and_print_result_full(&mut data, info.returns, &output_format, &options);
|
||||
format_and_print_result_full(&mut data, &info.returns, &output_format, &options);
|
||||
|
||||
Ok(Value::Null)
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ fn get(param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<Value, Error> {
|
||||
};
|
||||
|
||||
let options = default_table_format_options();
|
||||
format_and_print_result_full(&mut data, info.returns, &output_format, &options);
|
||||
format_and_print_result_full(&mut data, &info.returns, &output_format, &options);
|
||||
|
||||
Ok(Value::Null)
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ fn list_sync_jobs(param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<Value
|
||||
.column(ColumnConfig::new("schedule"))
|
||||
.column(ColumnConfig::new("comment"));
|
||||
|
||||
format_and_print_result_full(&mut data, info.returns, &output_format, &options);
|
||||
format_and_print_result_full(&mut data, &info.returns, &output_format, &options);
|
||||
|
||||
Ok(Value::Null)
|
||||
}
|
||||
@ -65,7 +65,7 @@ fn show_sync_job(param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<Value,
|
||||
};
|
||||
|
||||
let options = default_table_format_options();
|
||||
format_and_print_result_full(&mut data, info.returns, &output_format, &options);
|
||||
format_and_print_result_full(&mut data, &info.returns, &output_format, &options);
|
||||
|
||||
Ok(Value::Null)
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ fn list_users(param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<Value, Er
|
||||
.column(ColumnConfig::new("email"))
|
||||
.column(ColumnConfig::new("comment"));
|
||||
|
||||
format_and_print_result_full(&mut data, info.returns, &output_format, &options);
|
||||
format_and_print_result_full(&mut data, &info.returns, &output_format, &options);
|
||||
|
||||
Ok(Value::Null)
|
||||
}
|
||||
@ -87,7 +87,7 @@ fn list_tokens(param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<Value, E
|
||||
)
|
||||
.column(ColumnConfig::new("comment"));
|
||||
|
||||
format_and_print_result_full(&mut data, info.returns, &output_format, &options);
|
||||
format_and_print_result_full(&mut data, &info.returns, &output_format, &options);
|
||||
|
||||
Ok(Value::Null)
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ fn list_changers(
|
||||
.column(ColumnConfig::new("serial"))
|
||||
;
|
||||
|
||||
format_and_print_result_full(&mut data, info.returns, &output_format, &options);
|
||||
format_and_print_result_full(&mut data, &info.returns, &output_format, &options);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@ -139,7 +139,7 @@ fn scan_for_changers(
|
||||
.column(ColumnConfig::new("serial"))
|
||||
;
|
||||
|
||||
format_and_print_result_full(&mut data, info.returns, &output_format, &options);
|
||||
format_and_print_result_full(&mut data, &info.returns, &output_format, &options);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@ -175,7 +175,7 @@ fn get_config(
|
||||
.column(ColumnConfig::new("path"))
|
||||
;
|
||||
|
||||
format_and_print_result_full(&mut data, info.returns, &output_format, &options);
|
||||
format_and_print_result_full(&mut data, &info.returns, &output_format, &options);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@ -213,7 +213,7 @@ async fn get_status(
|
||||
.column(ColumnConfig::new("loaded-slot"))
|
||||
;
|
||||
|
||||
format_and_print_result_full(&mut data, info.returns, &output_format, &options);
|
||||
format_and_print_result_full(&mut data, &info.returns, &output_format, &options);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ fn list_drives(
|
||||
.column(ColumnConfig::new("serial"))
|
||||
;
|
||||
|
||||
format_and_print_result_full(&mut data, info.returns, &output_format, &options);
|
||||
format_and_print_result_full(&mut data, &info.returns, &output_format, &options);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@ -143,7 +143,7 @@ fn scan_for_drives(
|
||||
.column(ColumnConfig::new("serial"))
|
||||
;
|
||||
|
||||
format_and_print_result_full(&mut data, info.returns, &output_format, &options);
|
||||
format_and_print_result_full(&mut data, &info.returns, &output_format, &options);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@ -182,7 +182,7 @@ fn get_config(
|
||||
.column(ColumnConfig::new("changer-drive-id"))
|
||||
;
|
||||
|
||||
format_and_print_result_full(&mut data, info.returns, &output_format, &options);
|
||||
format_and_print_result_full(&mut data, &info.returns, &output_format, &options);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ async fn list_media(
|
||||
.column(ColumnConfig::new("media-set-uuid"))
|
||||
;
|
||||
|
||||
format_and_print_result_full(&mut data, info.returns, &output_format, &options);
|
||||
format_and_print_result_full(&mut data, &info.returns, &output_format, &options);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ fn list_pools(
|
||||
.column(ColumnConfig::new("template"))
|
||||
;
|
||||
|
||||
format_and_print_result_full(&mut data, info.returns, &output_format, &options);
|
||||
format_and_print_result_full(&mut data, &info.returns, &output_format, &options);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@ -131,7 +131,7 @@ fn get_config(
|
||||
.column(ColumnConfig::new("template"))
|
||||
;
|
||||
|
||||
format_and_print_result_full(&mut data, info.returns, &output_format, &options);
|
||||
format_and_print_result_full(&mut data, &info.returns, &output_format, &options);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -26,13 +26,14 @@ use proxmox::api::{
|
||||
ApiHandler,
|
||||
ApiMethod,
|
||||
HttpError,
|
||||
ParameterSchema,
|
||||
Permission,
|
||||
RpcEnvironment,
|
||||
RpcEnvironmentType,
|
||||
check_api_permission,
|
||||
};
|
||||
use proxmox::api::schema::{
|
||||
ObjectSchema,
|
||||
ObjectSchemaType,
|
||||
parse_parameter_strings,
|
||||
parse_simple_value,
|
||||
verify_json_object,
|
||||
@ -233,7 +234,7 @@ impl tower_service::Service<Request<Body>> for ApiService {
|
||||
}
|
||||
|
||||
fn parse_query_parameters<S: 'static + BuildHasher + Send>(
|
||||
param_schema: &ObjectSchema,
|
||||
param_schema: ParameterSchema,
|
||||
form: &str, // x-www-form-urlencoded body data
|
||||
parts: &Parts,
|
||||
uri_param: &HashMap<String, String, S>,
|
||||
@ -264,7 +265,7 @@ fn parse_query_parameters<S: 'static + BuildHasher + Send>(
|
||||
}
|
||||
|
||||
async fn get_request_parameters<S: 'static + BuildHasher + Send>(
|
||||
param_schema: &ObjectSchema,
|
||||
param_schema: ParameterSchema,
|
||||
parts: Parts,
|
||||
req_body: Body,
|
||||
uri_param: HashMap<String, String, S>,
|
||||
@ -305,7 +306,7 @@ async fn get_request_parameters<S: 'static + BuildHasher + Send>(
|
||||
params[&k] = parse_simple_value(&v, prop_schema)?;
|
||||
}
|
||||
}
|
||||
verify_json_object(¶ms, param_schema)?;
|
||||
verify_json_object(¶ms, ¶m_schema)?;
|
||||
return Ok(params);
|
||||
} else {
|
||||
parse_query_parameters(param_schema, utf8_data, &parts, &uri_param)
|
||||
|
Loading…
Reference in New Issue
Block a user