[pbs-devel] [PATCH v4 proxmox-backup 2/4] pxar: bin: use dedicated api type for restore pattern
Christian Ebner
c.ebner at proxmox.com
Thu Jun 13 14:58:16 CEST 2024
Instead of taking a plain string as input parameter, use the
corresponding api type performing additional input validation.
Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
---
changes since version 3:
- no changes
pxar-bin/Cargo.toml | 1 +
pxar-bin/src/main.rs | 10 +++-------
2 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/pxar-bin/Cargo.toml b/pxar-bin/Cargo.toml
index bb010ff78..aa53a1cf0 100644
--- a/pxar-bin/Cargo.toml
+++ b/pxar-bin/Cargo.toml
@@ -25,6 +25,7 @@ proxmox-router = { workspace = true, features = ["cli", "server"] }
proxmox-schema = { workspace = true, features = [ "api-macro" ] }
proxmox-sys.workspace = true
+pbs-api-types.workspace = true
pbs-client.workspace = true
pbs-pxar-fuse.workspace = true
pbs-tools.workspace = true
diff --git a/pxar-bin/src/main.rs b/pxar-bin/src/main.rs
index e62348e25..1ec1ff13d 100644
--- a/pxar-bin/src/main.rs
+++ b/pxar-bin/src/main.rs
@@ -12,6 +12,7 @@ use futures::select;
use tokio::signal::unix::{signal, SignalKind};
use pathpatterns::{MatchEntry, MatchType, PatternFlag};
+use pbs_api_types::PathPatterns;
use pbs_client::pxar::{
format_single_line_entry, Flags, OverwriteFlags, PxarExtractOptions, PxarWriters,
ENCODER_MAX_ENTRIES,
@@ -52,12 +53,7 @@ fn extract_archive_from_reader<R: std::io::Read>(
description: "Archive name.",
},
pattern: {
- description: "List of paths or pattern matching files to restore",
- type: Array,
- items: {
- type: String,
- description: "Path or pattern matching files to restore.",
- },
+ type: PathPatterns,
optional: true,
},
target: {
@@ -143,7 +139,7 @@ fn extract_archive_from_reader<R: std::io::Read>(
#[allow(clippy::too_many_arguments)]
fn extract_archive(
archive: String,
- pattern: Option<Vec<String>>,
+ pattern: Option<PathPatterns>,
target: Option<String>,
no_xattrs: bool,
no_fcaps: bool,
--
2.39.2
More information about the pbs-devel
mailing list