]> git.proxmox.com Git - proxmox-backup.git/blobdiff - src/api2/pull.rs
use RateLimitConfig for HttpClient and pull
[proxmox-backup.git] / src / api2 / pull.rs
index 3d644202fc1a12f11ea352514ee28d7d7282f698..aaeed4dea0c98c5c4f877817816b93e626decc81 100644 (file)
@@ -6,13 +6,13 @@ use futures::{select, future::FutureExt};
 
 use proxmox_schema::api;
 use proxmox_router::{ApiMethod, Router, RpcEnvironment, Permission};
+use proxmox_sys::task_log;
 
 use pbs_api_types::{
-    Authid, SyncJobConfig, GroupFilter, GROUP_FILTER_LIST_SCHEMA,
+    Authid, SyncJobConfig, GroupFilter, RateLimitConfig, GROUP_FILTER_LIST_SCHEMA,
     DATASTORE_SCHEMA, REMOTE_ID_SCHEMA, REMOVE_VANISHED_BACKUPS_SCHEMA,
     PRIV_DATASTORE_BACKUP, PRIV_DATASTORE_PRUNE, PRIV_REMOTE_READ,
 };
-use pbs_tools::task_log;
 use proxmox_rest_server::WorkerTask;
 use pbs_config::CachedUserInfo;
 
@@ -50,7 +50,8 @@ 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(),
+            sync_job.limit.clone(),
         )
     }
 }
@@ -152,10 +153,14 @@ pub fn do_sync_job(
                 schema: REMOVE_VANISHED_BACKUPS_SCHEMA,
                 optional: true,
             },
-            "groups": {
+            "group-filter": {
                 schema: GROUP_FILTER_LIST_SCHEMA,
                 optional: true,
             },
+            limit: {
+                type: RateLimitConfig,
+                flatten: true,
+            }
         },
     },
     access: {
@@ -173,13 +178,14 @@ async fn pull (
     remote: String,
     remote_store: String,
     remove_vanished: Option<bool>,
-    groups: Option<Vec<GroupFilter>>,
+    group_filter: Option<Vec<GroupFilter>>,
+    limit: RateLimitConfig,
     _info: &ApiMethod,
     rpcenv: &mut dyn RpcEnvironment,
 ) -> Result<String, Error> {
 
     let auth_id: Authid = rpcenv.get_auth_id().unwrap().parse()?;
-    let delete = remove_vanished.unwrap_or(true);
+    let delete = remove_vanished.unwrap_or(false);
 
     check_pull_privs(&auth_id, &store, &remote, &remote_store, delete)?;
 
@@ -189,7 +195,8 @@ async fn pull (
         &remote_store,
         auth_id.clone(),
         remove_vanished,
-        groups,
+        group_filter,
+        limit,
     )?;
     let client = pull_params.client().await?;