public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-backup] client: add "delete-groups" param to delete namespace
@ 2024-02-12 10:43 Gabriel Goller
  2024-02-13  9:48 ` [pbs-devel] applied: " Fabian Grünbichler
  0 siblings, 1 reply; 2+ messages in thread
From: Gabriel Goller @ 2024-02-12 10:43 UTC (permalink / raw)
  To: pbs-devel

The api parameter "delete-groups" was missing on the
proxmox-backup-client command. This allows the client to remove
non-empty namespaces.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
 proxmox-backup-client/src/namespace.rs | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/proxmox-backup-client/src/namespace.rs b/proxmox-backup-client/src/namespace.rs
index ce3f113b..abf31ef4 100644
--- a/proxmox-backup-client/src/namespace.rs
+++ b/proxmox-backup-client/src/namespace.rs
@@ -132,11 +132,15 @@ async fn create_namespace(param: Value) -> Result<(), Error> {
                 type: BackupNamespace,
                 optional: true,
             },
+            "delete-groups": {
+                description: "Destroys all groups in the hierarchy.",
+                optional: true,
+            },
         }
     },
 )]
 /// Delete an existing namespace.
-async fn delete_namespace(param: Value) -> Result<(), Error> {
+async fn delete_namespace(param: Value, delete_groups: Option<bool>) -> Result<(), Error> {
     let repo = extract_repository_from_value(&param)?;
     let backup_ns = optional_ns_param(&param)?;
 
@@ -145,7 +149,11 @@ async fn delete_namespace(param: Value) -> Result<(), Error> {
     }
 
     let path = format!("api2/json/admin/datastore/{}/namespace", repo.store());
-    let param = json!({ "ns": backup_ns });
+    let mut param = json!({ "ns": backup_ns });
+
+    if let Some(dg) = delete_groups {
+        param["delete-groups"] = serde_json::to_value(dg)?;
+    }
 
     let client = connect(&repo)?;
 
-- 
2.43.0





^ permalink raw reply	[flat|nested] 2+ messages in thread

* [pbs-devel] applied: [PATCH proxmox-backup] client: add "delete-groups" param to delete namespace
  2024-02-12 10:43 [pbs-devel] [PATCH proxmox-backup] client: add "delete-groups" param to delete namespace Gabriel Goller
@ 2024-02-13  9:48 ` Fabian Grünbichler
  0 siblings, 0 replies; 2+ messages in thread
From: Fabian Grünbichler @ 2024-02-13  9:48 UTC (permalink / raw)
  To: Proxmox Backup Server development discussion

but with a follow-up renaming 'dg' to 'value'..

On February 12, 2024 11:43 am, Gabriel Goller wrote:
> The api parameter "delete-groups" was missing on the
> proxmox-backup-client command. This allows the client to remove
> non-empty namespaces.
> 
> Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
> ---
>  proxmox-backup-client/src/namespace.rs | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/proxmox-backup-client/src/namespace.rs b/proxmox-backup-client/src/namespace.rs
> index ce3f113b..abf31ef4 100644
> --- a/proxmox-backup-client/src/namespace.rs
> +++ b/proxmox-backup-client/src/namespace.rs
> @@ -132,11 +132,15 @@ async fn create_namespace(param: Value) -> Result<(), Error> {
>                  type: BackupNamespace,
>                  optional: true,
>              },
> +            "delete-groups": {
> +                description: "Destroys all groups in the hierarchy.",
> +                optional: true,
> +            },
>          }
>      },
>  )]
>  /// Delete an existing namespace.
> -async fn delete_namespace(param: Value) -> Result<(), Error> {
> +async fn delete_namespace(param: Value, delete_groups: Option<bool>) -> Result<(), Error> {
>      let repo = extract_repository_from_value(&param)?;
>      let backup_ns = optional_ns_param(&param)?;
>  
> @@ -145,7 +149,11 @@ async fn delete_namespace(param: Value) -> Result<(), Error> {
>      }
>  
>      let path = format!("api2/json/admin/datastore/{}/namespace", repo.store());
> -    let param = json!({ "ns": backup_ns });
> +    let mut param = json!({ "ns": backup_ns });
> +
> +    if let Some(dg) = delete_groups {
> +        param["delete-groups"] = serde_json::to_value(dg)?;
> +    }
>  
>      let client = connect(&repo)?;
>  
> -- 
> 2.43.0
> 
> 
> 
> _______________________________________________
> pbs-devel mailing list
> pbs-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
> 
> 
> 




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-02-13  9:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-12 10:43 [pbs-devel] [PATCH proxmox-backup] client: add "delete-groups" param to delete namespace Gabriel Goller
2024-02-13  9:48 ` [pbs-devel] applied: " Fabian Grünbichler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal