Function edjx::storage::set_attributes [−][src]
pub fn set_attributes<B, FN>(
bucket_id: B,
file_name: FN,
attributes: FileAttributes
) -> Result<StorageResponse, StorageError> where
B: AsRef<str>,
FN: AsRef<str>,
Expand description
Sets the attributes associated with the given file.
This setting replaces the existing attributes.
Example
let bucket_id = "af66ad83-e55b-4a71-a7d5-6ec3199e42e9"; let file_name = "example.txt"; let mut properties: HashMap<String, String> = HashMap::new(); properties.insert("Content-Type".to_owned(), "image/jpeg".to_owned()); properties.insert("Cache-Control".to_owned(), "image/jpeg".to_owned()); let new_attributes = FileAttributes::new(Some(properties), None); let mut res_bytes: StorageResponse = match storage::set_attributes(&bucket_id, &file_name, new_attributes) { Ok(r) => r, Err(e) => { return HttpResponse::from(e.to_string().as_str().to_owned()) .set_status(e.to_http_status_code()) } };