Skip to main content

delete_objects_batch

Function delete_objects_batch 

Source
pub async fn delete_objects_batch(
    client: &Client,
    bucket: &str,
    keys: Vec<(ObjectKey, Option<String>)>,
) -> Result<DeleteReport, AppError>
Expand description

Delete a batch of objects from bucket.

Each entry in keys is (key, version_id?). Passing a version_id removes that specific version; passing None inserts a delete marker on versioned buckets and permanently deletes on non-versioned buckets.

Internally chunks keys into groups of at most 1 000 and issues one DeleteObjects SDK call per chunk. All chunk results are merged into a single DeleteReport.

§Partial failure (AC-4)

S3 can report per-key errors within a successful HTTP 200 response. These are collected into DeleteReport.failed rather than returning Err. The whole batch is NOT aborted on a per-key error.

§Errors

Returns Err(AppError) only when the SDK call itself fails (e.g. network error, bucket-level AccessDenied). Individual key errors are in DeleteReport.failed.