pub async fn set_object_metadata(
client: &Client,
bucket: &str,
key: &str,
metadata: HashMap<String, String>,
if_match_etag: Option<String>,
) -> Result<PutResult, AppError>Expand description
Replace the user-defined metadata on bucket/key.
Uses a self-referencing CopyObject (source = bucket/key,
destination = bucket/key) with MetadataDirective::Replace so the object
body is preserved on the server side.
§ETag precondition
When if_match_etag is Some(etag) the call sets copy-source-if-match.
On a 412 Precondition Failed response this returns
AppError::Conflict { etag_expected, etag_actual: None }.
§Errors
AppError::Conflict—if_match_etagsupplied and ETags do not match.AppError::AccessDenied—s3:CopyObjectpermission denied.AppError::NotFound— bucket or key does not exist.AppError::RateLimited— throttling response from AWS.AppError::Network— any other SDK or transport error.