all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Christian Ebner <c.ebner@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup v3 3/6] api: admin s3: make store prefix for check command optional
Date: Thu, 31 Jul 2025 12:48:11 +0200	[thread overview]
Message-ID: <20250731104814.99768-8-c.ebner@proxmox.com> (raw)
In-Reply-To: <20250731104814.99768-1-c.ebner@proxmox.com>

The store prefix is not really required for basic checks and was non
optional since the s3 clients relies on it for object key expansion,
so it should not be forgotten on regular datastore operations.

So make it optional instead. Since this relaxes the api constraints,
it is not a breaking api change.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
Reviewed-by: Lukas Wagner <l.wagner@proxmox.com>
---
changes since version 2:
- no changes

 src/api2/admin/s3.rs                 | 4 +++-
 src/bin/proxmox_backup_manager/s3.rs | 3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/api2/admin/s3.rs b/src/api2/admin/s3.rs
index 90cc41ea6..209feaebc 100644
--- a/src/api2/admin/s3.rs
+++ b/src/api2/admin/s3.rs
@@ -28,6 +28,7 @@ use pbs_config::s3::S3_CFG_TYPE_ID;
             "store-prefix": {
                 type: String,
                 description: "Store prefix within bucket for S3 object keys (commonly datastore name)",
+                optional: true,
             },
         },
     },
@@ -39,7 +40,7 @@ use pbs_config::s3::S3_CFG_TYPE_ID;
 pub async fn check(
     s3_client_id: String,
     bucket: String,
-    store_prefix: String,
+    store_prefix: Option<String>,
     _rpcenv: &mut dyn RpcEnvironment,
 ) -> Result<Value, Error> {
     let (config, _digest) = pbs_config::s3::config()?;
@@ -47,6 +48,7 @@ pub async fn check(
         .lookup(S3_CFG_TYPE_ID, &s3_client_id)
         .context("config lookup failed")?;
 
+    let store_prefix = store_prefix.unwrap_or_default();
     let options =
         S3ClientOptions::from_config(config.config, config.secret_key, Some(bucket), store_prefix);
 
diff --git a/src/bin/proxmox_backup_manager/s3.rs b/src/bin/proxmox_backup_manager/s3.rs
index 867bc8e6b..f660baf4a 100644
--- a/src/bin/proxmox_backup_manager/s3.rs
+++ b/src/bin/proxmox_backup_manager/s3.rs
@@ -19,6 +19,7 @@ use serde_json::Value;
             "store-prefix": {
                 type: String,
                 description: "Store prefix within bucket for S3 object keys (commonly datastore name)",
+                optional: true,
             },
         },
     },
@@ -27,7 +28,7 @@ use serde_json::Value;
 async fn check(
     s3_endpoint_id: String,
     bucket: String,
-    store_prefix: String,
+    store_prefix: Option<String>,
     rpcenv: &mut dyn RpcEnvironment,
 ) -> Result<Value, Error> {
     api2::admin::s3::check(s3_endpoint_id, bucket, store_prefix, rpcenv).await?;
-- 
2.47.2



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


  parent reply	other threads:[~2025-07-31 10:47 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-31 10:48 [pbs-devel] [PATCH proxmox{, -backup} v3 00/10] s3: implement list buckets and use bucket selector for datastore creation Christian Ebner
2025-07-31 10:48 ` [pbs-devel] [PATCH proxmox v3 1/4] s3 client: restrict bucket template pattern to start of endpoint url Christian Ebner
2025-07-31 10:48 ` [pbs-devel] [PATCH proxmox v3 2/4] s3 client: make bucket name optional in S3 client options Christian Ebner
2025-07-31 10:48 ` [pbs-devel] [PATCH proxmox v3 3/4] s3 client: implement list buckets method Christian Ebner
2025-07-31 11:43   ` Lukas Wagner
2025-07-31 10:48 ` [pbs-devel] [PATCH proxmox v3 4/4] s3 client: api types: add bucket list item type Christian Ebner
2025-07-31 10:48 ` [pbs-devel] [PATCH proxmox-backup v3 1/6] ui: fix formatting issues using proxmox-biome Christian Ebner
2025-07-31 10:48 ` [pbs-devel] [PATCH proxmox-backup v3 2/6] datastore: wrap bucket name, as in is now optional in the s3 client Christian Ebner
2025-07-31 10:48 ` Christian Ebner [this message]
2025-07-31 10:48 ` [pbs-devel] [PATCH proxmox-backup v3 4/6] api: config s3: add bucket list api endpoint Christian Ebner
2025-07-31 10:48 ` [pbs-devel] [PATCH proxmox-backup v3 5/6] bin: expose list buckets as proxmox-backup-manager s3 subcommand Christian Ebner
2025-07-31 10:48 ` [pbs-devel] [PATCH proxmox-backup v3 6/6] ui: replace bucket field by bucket selector Christian Ebner
2025-07-31 11:55 ` [pbs-devel] [PATCH proxmox{, -backup} v3 00/10] s3: implement list buckets and use bucket selector for datastore creation Lukas Wagner
2025-07-31 13:02 ` Christian Ebner
2025-07-31 13:17   ` Thomas Lamprecht
2025-07-31 13:28     ` Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250731104814.99768-8-c.ebner@proxmox.com \
    --to=c.ebner@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal