public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox] s3-client: make storage class in list objects v2 response optional
@ 2025-10-20  9:15 Christian Ebner
  2025-11-11 14:15 ` [pbs-devel] applied: " Fabian Grünbichler
  0 siblings, 1 reply; 2+ messages in thread
From: Christian Ebner @ 2025-10-20  9:15 UTC (permalink / raw)
  To: pbs-devel

Some providers (e.g. Google cloud) do not include the storage class
field in list objects v2 responses.

Make the storage field optional, so response parsing does not fail if
it is absent.

Since the PBS S3 backend does not use this field, and is currently
the only user of the crate, no further code adaptions are necessary.

Reported-by: https://forum.proxmox.com/threads/173256/
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
 proxmox-s3-client/src/response_reader.rs | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/proxmox-s3-client/src/response_reader.rs b/proxmox-s3-client/src/response_reader.rs
index afe501d5..bc01db6a 100644
--- a/proxmox-s3-client/src/response_reader.rs
+++ b/proxmox-s3-client/src/response_reader.rs
@@ -92,7 +92,7 @@ pub struct ListObjectsV2Contents {
     /// Content size of object.
     pub size: u64,
     /// Storage class the object is stored on.
-    pub storage_class: String,
+    pub storage_class: Option<String>,
 }
 
 #[derive(Debug)]
@@ -563,14 +563,14 @@ fn parse_list_objects_v2_response_test() {
                 last_modified: LastModifiedTimestamp::from_str("2011-02-26T01:56:20.000Z").unwrap(),
                 e_tag: "\"bf1d737a4d46a19f3bced6905cc8b902\"".to_string(),
                 size: 10,
-                storage_class: "STANDARD".to_string(),
+                storage_class: Some("STANDARD".to_string()),
             },
             ListObjectsV2Contents {
                 key: S3ObjectKey::try_from("/.cnt/key1").unwrap(),
                 last_modified: LastModifiedTimestamp::from_str("2011-02-26T01:56:20.000Z").unwrap(),
                 e_tag: "\"9b2cf535f27731c974343645a3985328\"".to_string(),
                 size: 20,
-                storage_class: "STANDARD".to_string(),
+                storage_class: Some("STANDARD".to_string()),
             },
         ]
     );
-- 
2.47.3



_______________________________________________
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

* [pbs-devel] applied: [PATCH proxmox] s3-client: make storage class in list objects v2 response optional
  2025-10-20  9:15 [pbs-devel] [PATCH proxmox] s3-client: make storage class in list objects v2 response optional Christian Ebner
@ 2025-11-11 14:15 ` Fabian Grünbichler
  0 siblings, 0 replies; 2+ messages in thread
From: Fabian Grünbichler @ 2025-11-11 14:15 UTC (permalink / raw)
  To: Proxmox Backup Server development discussion

thanks!

On October 20, 2025 11:15 am, Christian Ebner wrote:
> Some providers (e.g. Google cloud) do not include the storage class
> field in list objects v2 responses.
> 
> Make the storage field optional, so response parsing does not fail if
> it is absent.
> 
> Since the PBS S3 backend does not use this field, and is currently
> the only user of the crate, no further code adaptions are necessary.
> 
> Reported-by: https://forum.proxmox.com/threads/173256/
> Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
> ---
>  proxmox-s3-client/src/response_reader.rs | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/proxmox-s3-client/src/response_reader.rs b/proxmox-s3-client/src/response_reader.rs
> index afe501d5..bc01db6a 100644
> --- a/proxmox-s3-client/src/response_reader.rs
> +++ b/proxmox-s3-client/src/response_reader.rs
> @@ -92,7 +92,7 @@ pub struct ListObjectsV2Contents {
>      /// Content size of object.
>      pub size: u64,
>      /// Storage class the object is stored on.
> -    pub storage_class: String,
> +    pub storage_class: Option<String>,
>  }
>  
>  #[derive(Debug)]
> @@ -563,14 +563,14 @@ fn parse_list_objects_v2_response_test() {
>                  last_modified: LastModifiedTimestamp::from_str("2011-02-26T01:56:20.000Z").unwrap(),
>                  e_tag: "\"bf1d737a4d46a19f3bced6905cc8b902\"".to_string(),
>                  size: 10,
> -                storage_class: "STANDARD".to_string(),
> +                storage_class: Some("STANDARD".to_string()),
>              },
>              ListObjectsV2Contents {
>                  key: S3ObjectKey::try_from("/.cnt/key1").unwrap(),
>                  last_modified: LastModifiedTimestamp::from_str("2011-02-26T01:56:20.000Z").unwrap(),
>                  e_tag: "\"9b2cf535f27731c974343645a3985328\"".to_string(),
>                  size: 20,
> -                storage_class: "STANDARD".to_string(),
> +                storage_class: Some("STANDARD".to_string()),
>              },
>          ]
>      );
> -- 
> 2.47.3
> 
> 
> 
> _______________________________________________
> pbs-devel mailing list
> pbs-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
> 
> 
> 


_______________________________________________
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:[~2025-11-11 14:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-20  9:15 [pbs-devel] [PATCH proxmox] s3-client: make storage class in list objects v2 response optional Christian Ebner
2025-11-11 14:15 ` [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