Skip to main content

set_object_metadata

Function set_object_metadata 

Source
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::Conflictif_match_etag supplied and ETags do not match.
  • AppError::AccessDenieds3:CopyObject permission denied.
  • AppError::NotFound — bucket or key does not exist.
  • AppError::RateLimited — throttling response from AWS.
  • AppError::Network — any other SDK or transport error.