(&self, bucket: &str, key: &str, vec: Vec<u8>)
| 38 | #[async_trait] |
| 39 | impl PutFile for S3Client { |
| 40 | async fn put_file(&self, bucket: &str, key: &str, vec: Vec<u8>) -> Result<String, String> { |
| 41 | tracing::info!("put file bucket {}, key {}", bucket, key); |
| 42 | let bytes = ByteStream::from(vec); |
| 43 | let result = self.put_object().bucket(bucket).key(key).body(bytes).send().await; |
| 44 | |
| 45 | match result { |
| 46 | Ok(_) => Ok(format!("Uploaded a file with key {key} into {bucket}")), |
| 47 | Err(err) => Err(err.into_service_error().meta().message().unwrap().to_string()), |
| 48 | } |
| 49 | } |
| 50 | } |
no test coverage detected