]> git.proxmox.com Git - proxmox-backup.git/commitdiff
group filter: rename CLI/API/Config "groups" option to "group-filter"
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 18 Nov 2021 08:50:47 +0000 (09:50 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 18 Nov 2021 09:36:57 +0000 (10:36 +0100)
we even use that for basically all the related schema names, "groups"
allone is just rather not so telling, i.e., "groups" what?

While due to the additive nature of `group-filter` is not the best
possible name for passing multiple arguments on the CLI (the web-ui
can present this more UX-friendly anyway) due to possible confusion
about if the filter act like AND vs OR it can be documented and even
if a user is confused they still are safe on more being synced than
less. Also, the original param name wasn't really _that_ better in
that regards

Dietmar also suggested to use singular for the CLI option, while
there can be more they're passed over repeating the option, each with
a single filter.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
pbs-api-types/src/jobs.rs
src/api2/config/sync.rs
src/api2/config/tape_backup_job.rs
src/api2/pull.rs
src/api2/tape/backup.rs
src/bin/proxmox-backup-manager.rs

index 601d86f90e9a3fc282178c72fd92aa54d1a6dbb1..2a7e201b48286729f69e823303e71f9311d6580e 100644 (file)
@@ -247,7 +247,7 @@ pub struct VerificationJobStatus {
             optional: true,
             type: Userid,
         },
-        groups: {
+        "group-filter": {
             schema: GROUP_FILTER_LIST_SCHEMA,
             optional: true,
         },
@@ -270,7 +270,7 @@ pub struct TapeBackupJobSetup {
     #[serde(skip_serializing_if="Option::is_none")]
     pub notify_user: Option<Userid>,
     #[serde(skip_serializing_if="Option::is_none")]
-    pub groups: Option<Vec<GroupFilter>>,
+    pub group_filter: Option<Vec<GroupFilter>>,
 }
 
 #[api(
@@ -409,7 +409,7 @@ pub const GROUP_FILTER_LIST_SCHEMA: Schema = ArraySchema::new("List of group fil
             optional: true,
             schema: SYNC_SCHEDULE_SCHEMA,
         },
-        groups: {
+        "group-filter": {
             schema: GROUP_FILTER_LIST_SCHEMA,
             optional: true,
         },
@@ -433,7 +433,7 @@ pub struct SyncJobConfig {
     #[serde(skip_serializing_if="Option::is_none")]
     pub schedule: Option<String>,
     #[serde(skip_serializing_if="Option::is_none")]
-    pub groups: Option<Vec<GroupFilter>>,
+    pub group_filter: Option<Vec<GroupFilter>>,
 }
 
 #[api(
index 890221e6ed8d5e5b4ed3fc6aed5748edb5649466..2028d0383dac2f0b872a615d51d728280b640db2 100644 (file)
@@ -192,8 +192,8 @@ pub enum DeletableProperty {
     schedule,
     /// Delete the remove-vanished flag.
     remove_vanished,
-    /// Delete the groups property.
-    groups,
+    /// Delete the group_filter property.
+    group_filter,
 }
 
 #[api(
@@ -256,7 +256,7 @@ pub fn update_sync_job(
                 DeletableProperty::comment => { data.comment = None; },
                 DeletableProperty::schedule => { data.schedule = None; },
                 DeletableProperty::remove_vanished => { data.remove_vanished = None; },
-                DeletableProperty::groups => { data.groups = None; },
+                DeletableProperty::group_filter => { data.group_filter = None; },
             }
         }
     }
@@ -274,7 +274,7 @@ pub fn update_sync_job(
     if let Some(remote) = update.remote { data.remote = remote; }
     if let Some(remote_store) = update.remote_store { data.remote_store = remote_store; }
     if let Some(owner) = update.owner { data.owner = Some(owner); }
-    if let Some(groups) = update.groups { data.groups = Some(groups); }
+    if let Some(group_filter) = update.group_filter { data.group_filter = Some(group_filter); }
 
     let schedule_changed = data.schedule != update.schedule;
     if update.schedule.is_some() { data.schedule = update.schedule; }
@@ -394,7 +394,7 @@ acl:1:/remote/remote1/remotestore1:write@pbs:RemoteSyncOperator
         owner: Some(write_auth_id.clone()),
         comment: None,
         remove_vanished: None,
-        groups: None,
+        group_filter: None,
         schedule: None,
     };
 
index 84dda07561f7c81e5a8403f15366d36149afd6b5..3be80f6a13efbf2e5ed35a0a7cb2e09279e48a72 100644 (file)
@@ -133,8 +133,8 @@ pub enum DeletableProperty {
     LatestOnly,
     /// Delete the 'notify-user' property
     NotifyUser,
-    /// Delete the 'groups' property
-    Groups,
+    /// Delete the 'group_filter' property
+    GroupFilter,
 }
 
 #[api(
@@ -193,7 +193,7 @@ pub fn update_tape_backup_job(
                 DeletableProperty::NotifyUser => { data.setup.notify_user = None; },
                 DeletableProperty::Schedule => { data.schedule = None; },
                 DeletableProperty::Comment => { data.comment = None; },
-                DeletableProperty::Groups => { data.setup.groups = None; },
+                DeletableProperty::GroupFilter => { data.setup.group_filter = None; },
             }
         }
     }
@@ -206,7 +206,7 @@ pub fn update_tape_backup_job(
     if update.setup.export_media_set.is_some() { data.setup.export_media_set = update.setup.export_media_set; }
     if update.setup.latest_only.is_some() { data.setup.latest_only = update.setup.latest_only; }
     if update.setup.notify_user.is_some() { data.setup.notify_user = update.setup.notify_user; }
-    if update.setup.groups.is_some() { data.setup.groups = update.setup.groups; }
+    if update.setup.group_filter.is_some() { data.setup.group_filter = update.setup.group_filter; }
 
     let schedule_changed = data.schedule != update.schedule;
     if update.schedule.is_some() { data.schedule = update.schedule; }
index acbd2884b28361a304afbbdadde5ba5b6d6bb84a..30ee5fe5991a8520ab6e1806ad92efa80761bbc2 100644 (file)
@@ -50,7 +50,7 @@ impl TryFrom<&SyncJobConfig> for PullParameters {
             &sync_job.remote_store,
             sync_job.owner.as_ref().unwrap_or_else(|| Authid::root_auth_id()).clone(),
             sync_job.remove_vanished,
-            sync_job.groups.clone(),
+            sync_job.group_filter.clone(),
         )
     }
 }
@@ -152,7 +152,7 @@ pub fn do_sync_job(
                 schema: REMOVE_VANISHED_BACKUPS_SCHEMA,
                 optional: true,
             },
-            "groups": {
+            "group-filter": {
                 schema: GROUP_FILTER_LIST_SCHEMA,
                 optional: true,
             },
@@ -173,7 +173,7 @@ async fn pull (
     remote: String,
     remote_store: String,
     remove_vanished: Option<bool>,
-    groups: Option<Vec<GroupFilter>>,
+    group_filter: Option<Vec<GroupFilter>>,
     _info: &ApiMethod,
     rpcenv: &mut dyn RpcEnvironment,
 ) -> Result<String, Error> {
@@ -189,7 +189,7 @@ async fn pull (
         &remote_store,
         auth_id.clone(),
         remove_vanished,
-        groups,
+        group_filter,
     )?;
     let client = pull_params.client().await?;
 
index 1d7754598d15da70d397d7d99a9d99e99460a51c..008b07320cbd8d572955cacc9e0d30280cbbd062 100644 (file)
@@ -437,7 +437,7 @@ fn backup_worker(
 
     group_list.sort_unstable();
 
-    let (group_list, group_count) = if let Some(group_filters) = &setup.groups {
+    let (group_list, group_count) = if let Some(group_filters) = &setup.group_filter {
         let filter_fn = |group: &BackupGroup, group_filters: &[GroupFilter]| {
             group_filters.iter().any(|filter| group.matches(filter))
         };
index 00e02b3f98b66b77c5e5f3163c529b23e2c49bf6..eea262c56d7a06314f5403adbd998c5bf88190f0 100644 (file)
@@ -240,7 +240,7 @@ fn task_mgmt_cli() -> CommandLineInterface {
                 schema: REMOVE_VANISHED_BACKUPS_SCHEMA,
                 optional: true,
             },
-            "groups": {
+            "group-filter": {
                 schema: GROUP_FILTER_LIST_SCHEMA,
                 optional: true,
             },
@@ -257,7 +257,7 @@ async fn pull_datastore(
     remote_store: String,
     local_store: String,
     remove_vanished: Option<bool>,
-    groups: Option<Vec<GroupFilter>>,
+    group_filter: Option<Vec<GroupFilter>>,
     param: Value,
 ) -> Result<Value, Error> {
 
@@ -271,8 +271,8 @@ async fn pull_datastore(
         "remote-store": remote_store,
     });
 
-    if groups.is_some() {
-        args["groups"] = json!(groups);
+    if group_filter.is_some() {
+        args["group-filter"] = json!(group_filter);
     }
 
     if let Some(remove_vanished) = remove_vanished {
@@ -400,7 +400,7 @@ async fn run() -> Result<(), Error> {
                 .completion_cb("local-store", pbs_config::datastore::complete_datastore_name)
                 .completion_cb("remote", pbs_config::remote::complete_remote_name)
                 .completion_cb("remote-store", complete_remote_datastore_name)
-                .completion_cb("groups", complete_remote_datastore_group_filter)
+                .completion_cb("group_filter", complete_remote_datastore_group_filter)
         )
         .insert(
             "verify",