Compare commits

..
Author SHA1 Message Date
phoenix f99a77ece0 Code formatting
simodels Build / Rustfmt (pull_request) Successful in 1m21s
simodels Build / Clippy (pull_request) Successful in 1m32s
simodels Build / Check (pull_request) Successful in 1m40s
simodels Build / Test Suite (pull_request) Successful in 1m42s
labyrinth release Tagging / release (pull_request) Successful in 2m25s
simodels Build / build (pull_request) Successful in 3m7s
2026-08-11 10:20:44 -04:00
phoenix 3d3568d5a5 Added code for deleting object from storage 2026-08-11 10:20:29 -04:00
+21
View File
@@ -47,6 +47,7 @@ pub enum Error {
}
impl Labyrinth {
/// Upload object to the bucket
pub async fn upload(
&self,
file_key: &str,
@@ -77,6 +78,7 @@ impl Labyrinth {
}
}
/// Download object from the bucket
pub async fn download(&self, file_key: &str) -> Result<Vec<u8>, Error> {
let client = init_client(&self.config).await;
@@ -103,4 +105,23 @@ impl Labyrinth {
Err(err) => Err(Error::Info(err.to_string())),
}
}
/// Delete an object from the bucket
pub async fn delete(
&self,
file_key: &str,
) -> Result<aws_sdk_s3::operation::delete_object::DeleteObjectOutput, Error> {
let client = init_client(&self.config).await;
match client
.delete_object()
.bucket(self.config.bucket.clone())
.key(file_key)
.send()
.await
{
Ok(response) => Ok(response),
Err(err) => Err(Error::Info(err.to_string())),
}
}
}