Skip to main content

put_object_text

Function put_object_text 

Source
pub async fn put_object_text(
    client: &Client,
    bucket: &str,
    key: &str,
    body: String,
    if_match_etag: Option<String>,
) -> Result<PutResult, AppError>
Expand description

Write body to bucket/key with an optional ETag precondition.

Uses PutObject with Content-Type: text/plain; charset=utf-8. When if_match_etag is supplied the If-Match header is set; S3 returns 412 (Precondition Failed) when the live ETag does not match — mapped to AppError::Conflict { etag_expected, etag_actual: None }.

§OCP

if_match_etag = None is the “save anyway” path — identical to a fresh unconditional put.

§Errors

  • AppError::Conflict — ETag precondition failed (412).
  • AppError::AccessDenieds3:PutObject permission denied.
  • AppError::NotFound — bucket does not exist.
  • AppError::Network — any other SDK or transport error.