From acffe8636551b554df189dc4b58dd394297c7fac Mon Sep 17 00:00:00 2001 From: kdesjard Date: Wed, 27 Mar 2024 18:29:19 -0400 Subject: [PATCH] S3object meta (#669) capture more of the object's metadata into S3Object, specifically: storage_class size last_modified --------- Co-authored-by: kdesjard Co-authored-by: Patrick Crumley --- crates/esthri/src/lib.rs | 8 +++++++- crates/esthri/src/types.rs | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/crates/esthri/src/lib.rs b/crates/esthri/src/lib.rs index 5f410cfe..3f5045d2 100644 --- a/crates/esthri/src/lib.rs +++ b/crates/esthri/src/lib.rs @@ -378,7 +378,13 @@ async fn list_objects_request( for object in contents { match (object.key, object.e_tag) { (Some(key), Some(e_tag)) => { - listing.contents.push(S3Object { key, e_tag }); + listing.contents.push(S3Object { + key, + e_tag, + storage_class: object.storage_class, + size: object.size, + last_modified: object.last_modified, + }); } (key, etag) => { if key.is_none() { diff --git a/crates/esthri/src/types.rs b/crates/esthri/src/types.rs index c24919ef..9529c38c 100644 --- a/crates/esthri/src/types.rs +++ b/crates/esthri/src/types.rs @@ -17,6 +17,8 @@ use std::{ result::Result as StdResult, }; +use aws_sdk_s3::primitives::DateTime; +use aws_sdk_s3::types::ObjectStorageClass; use regex::Regex; use serde::{Deserialize, Deserializer, Serialize, Serializer}; @@ -149,9 +151,13 @@ impl S3Listing { } #[derive(Debug, Clone)] +#[non_exhaustive] pub struct S3Object { pub key: String, pub e_tag: String, + pub storage_class: Option, + pub size: Option, + pub last_modified: Option, } /// For syncing from remote to local, or local to remote, "metadata" is attached to the listing in