[pbs-devel] [PATCH backup 1/2] adaptions for proxmox 0.9 and proxmox-api-macro 0.3
Wolfgang Bumiller
w.bumiller at proxmox.com
Fri Dec 18 12:26:07 CET 2020
Signed-off-by: Wolfgang Bumiller <w.bumiller at proxmox.com>
---
src/api2/admin/datastore.rs | 8 ++++----
src/bin/proxmox-backup-client.rs | 12 ++++++------
src/bin/proxmox-backup-manager.rs | 12 ++++++------
src/bin/proxmox-tape.rs | 4 ++--
src/bin/proxmox_backup_client/benchmark.rs | 5 +++--
src/bin/proxmox_backup_client/key.rs | 10 ++++++++--
src/bin/proxmox_backup_client/snapshot.rs | 9 +++++----
src/bin/proxmox_backup_client/task.rs | 4 ++--
src/bin/proxmox_backup_manager/acl.rs | 2 +-
src/bin/proxmox_backup_manager/datastore.rs | 4 ++--
src/bin/proxmox_backup_manager/disk.rs | 8 ++++----
src/bin/proxmox_backup_manager/dns.rs | 2 +-
src/bin/proxmox_backup_manager/network.rs | 2 +-
src/bin/proxmox_backup_manager/remote.rs | 4 ++--
src/bin/proxmox_backup_manager/subscription.rs | 2 +-
src/bin/proxmox_backup_manager/sync.rs | 4 ++--
src/bin/proxmox_backup_manager/user.rs | 4 ++--
src/bin/proxmox_tape/changer.rs | 8 ++++----
src/bin/proxmox_tape/drive.rs | 6 +++---
src/bin/proxmox_tape/media.rs | 2 +-
src/bin/proxmox_tape/pool.rs | 4 ++--
src/server/rest.rs | 9 +++++----
22 files changed, 67 insertions(+), 58 deletions(-)
diff --git a/src/api2/admin/datastore.rs b/src/api2/admin/datastore.rs
index 16fee943..32352e5c 100644
--- a/src/api2/admin/datastore.rs
+++ b/src/api2/admin/datastore.rs
@@ -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,
diff --git a/src/bin/proxmox-backup-client.rs b/src/bin/proxmox-backup-client.rs
index 6cf81952..b8f09a4a 100644
--- a/src/bin/proxmox-backup-client.rs
+++ b/src/bin/proxmox-backup-client.rs
@@ -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)
}
diff --git a/src/bin/proxmox-backup-manager.rs b/src/bin/proxmox-backup-manager.rs
index 8ad4c7dc..ff2a1dc1 100644
--- a/src/bin/proxmox-backup-manager.rs
+++ b/src/bin/proxmox-backup-manager.rs
@@ -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)
}
diff --git a/src/bin/proxmox-tape.rs b/src/bin/proxmox-tape.rs
index 9ed9aca9..5c3e8036 100644
--- a/src/bin/proxmox-tape.rs
+++ b/src/bin/proxmox-tape.rs
@@ -311,7 +311,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(())
}
@@ -383,7 +383,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(())
}
diff --git a/src/bin/proxmox_backup_client/benchmark.rs b/src/bin/proxmox_backup_client/benchmark.rs
index e53e43ce..2ecb3dc9 100644
--- a/src/bin/proxmox_backup_client/benchmark.rs
+++ b/src/bin/proxmox_backup_client/benchmark.rs
@@ -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(())
}
diff --git a/src/bin/proxmox_backup_client/key.rs b/src/bin/proxmox_backup_client/key.rs
index e49131c1..109f0384 100644
--- a/src/bin/proxmox_backup_client/key.rs
+++ b/src/bin/proxmox_backup_client/key.rs
@@ -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(())
}
diff --git a/src/bin/proxmox_backup_client/snapshot.rs b/src/bin/proxmox_backup_client/snapshot.rs
index 7be0480f..3bdc5f33 100644
--- a/src/bin/proxmox_backup_client/snapshot.rs
+++ b/src/bin/proxmox_backup_client/snapshot.rs
@@ -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)
}
diff --git a/src/bin/proxmox_backup_client/task.rs b/src/bin/proxmox_backup_client/task.rs
index 6f567f22..e4adaf58 100644
--- a/src/bin/proxmox_backup_client/task.rs
+++ b/src/bin/proxmox_backup_client/task.rs
@@ -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)
}
diff --git a/src/bin/proxmox_backup_manager/acl.rs b/src/bin/proxmox_backup_manager/acl.rs
index 7511c8cb..b23943ca 100644
--- a/src/bin/proxmox_backup_manager/acl.rs
+++ b/src/bin/proxmox_backup_manager/acl.rs
@@ -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)
}
diff --git a/src/bin/proxmox_backup_manager/datastore.rs b/src/bin/proxmox_backup_manager/datastore.rs
index 94590aaf..7e596a1b 100644
--- a/src/bin/proxmox_backup_manager/datastore.rs
+++ b/src/bin/proxmox_backup_manager/datastore.rs
@@ -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)
}
diff --git a/src/bin/proxmox_backup_manager/disk.rs b/src/bin/proxmox_backup_manager/disk.rs
index 70de4775..164f8831 100644
--- a/src/bin/proxmox_backup_manager/disk.rs
+++ b/src/bin/proxmox_backup_manager/disk.rs
@@ -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)
}
diff --git a/src/bin/proxmox_backup_manager/dns.rs b/src/bin/proxmox_backup_manager/dns.rs
index c735b22e..9a91cb06 100644
--- a/src/bin/proxmox_backup_manager/dns.rs
+++ b/src/bin/proxmox_backup_manager/dns.rs
@@ -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)
}
diff --git a/src/bin/proxmox_backup_manager/network.rs b/src/bin/proxmox_backup_manager/network.rs
index d7f6382f..c9489f7d 100644
--- a/src/bin/proxmox_backup_manager/network.rs
+++ b/src/bin/proxmox_backup_manager/network.rs
@@ -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)
}
diff --git a/src/bin/proxmox_backup_manager/remote.rs b/src/bin/proxmox_backup_manager/remote.rs
index 04d714ef..b1c4aa45 100644
--- a/src/bin/proxmox_backup_manager/remote.rs
+++ b/src/bin/proxmox_backup_manager/remote.rs
@@ -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)
}
diff --git a/src/bin/proxmox_backup_manager/subscription.rs b/src/bin/proxmox_backup_manager/subscription.rs
index 79813a35..cd69d8d3 100644
--- a/src/bin/proxmox_backup_manager/subscription.rs
+++ b/src/bin/proxmox_backup_manager/subscription.rs
@@ -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)
}
diff --git a/src/bin/proxmox_backup_manager/sync.rs b/src/bin/proxmox_backup_manager/sync.rs
index f21ecb5f..f05f0c8d 100644
--- a/src/bin/proxmox_backup_manager/sync.rs
+++ b/src/bin/proxmox_backup_manager/sync.rs
@@ -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)
}
diff --git a/src/bin/proxmox_backup_manager/user.rs b/src/bin/proxmox_backup_manager/user.rs
index 516d27f2..8d78b08c 100644
--- a/src/bin/proxmox_backup_manager/user.rs
+++ b/src/bin/proxmox_backup_manager/user.rs
@@ -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)
}
diff --git a/src/bin/proxmox_tape/changer.rs b/src/bin/proxmox_tape/changer.rs
index 0a8b794e..9db1644e 100644
--- a/src/bin/proxmox_tape/changer.rs
+++ b/src/bin/proxmox_tape/changer.rs
@@ -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(())
}
diff --git a/src/bin/proxmox_tape/drive.rs b/src/bin/proxmox_tape/drive.rs
index 0949d450..73e34afc 100644
--- a/src/bin/proxmox_tape/drive.rs
+++ b/src/bin/proxmox_tape/drive.rs
@@ -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(())
}
diff --git a/src/bin/proxmox_tape/media.rs b/src/bin/proxmox_tape/media.rs
index 374cb891..0767bdb0 100644
--- a/src/bin/proxmox_tape/media.rs
+++ b/src/bin/proxmox_tape/media.rs
@@ -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(())
}
diff --git a/src/bin/proxmox_tape/pool.rs b/src/bin/proxmox_tape/pool.rs
index 23e8e83e..4d477aaf 100644
--- a/src/bin/proxmox_tape/pool.rs
+++ b/src/bin/proxmox_tape/pool.rs
@@ -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(())
}
diff --git a/src/server/rest.rs b/src/server/rest.rs
index da110507..c1c4fd55 100644
--- a/src/server/rest.rs
+++ b/src/server/rest.rs
@@ -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)
--
2.20.1
More information about the pbs-devel
mailing list