Compare commits

...
Author SHA1 Message Date
phoenix f406ed1961 Delete object (#3)
labyrinth release Tagging / release (push) Successful in 1m15s
simodels Build / build (push) Successful in 1m25s
simodels Build / Test Suite (push) Successful in 1m35s
simodels Build / Check (push) Successful in 1m38s
simodels Build / Rustfmt (push) Successful in 2m33s
simodels Build / Clippy (push) Successful in 2m49s
Reviewed-on: #3
2026-08-11 10:39:12 -04:00
3 changed files with 23 additions and 2 deletions
Generated
+1 -1
View File
@@ -1370,7 +1370,7 @@ dependencies = [
[[package]]
name = "labyrinth"
version = "0.0.3"
version = "0.0.4"
dependencies = [
"aws-config",
"aws-sdk-s3",
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "labyrinth"
version = "0.0.3"
version = "0.0.4"
edition = "2024"
license = "MIT"
description = "Library for managing soaricarus storage"
+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())),
}
}
}