Sample code for 30+ languages & platforms
Rust Requires Chilkat v11.0.0+

Backblaze S3 Delete Bucket Objects

See more Backblaze S3 Examples

Demonstrates how to delete objects in a bucket.

Chilkat Rust Downloads

Rust

// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

let http = chilkat::Http::new();

// keyID = Access Key ID or Access Key
http.set_aws_access_key("access-key");

// applicationKey = Secret Access Key or Secret Key
http.set_aws_secret_key("secret-key");

// Region is the 2nd part of your S3 Endpoint
http.set_aws_endpoint("s3.us-west-002.backblazeb2.com");

let bucket_name = "chilkat-test".to_string();

let object_name1 = "seahorse.jpg".to_string();
let object_name2 = "orchard.json".to_string();

let st = chilkat::StringTable::new();
let _ = st.append(&object_name1);
let _ = st.append(&object_name2);

let json_resp = chilkat::JsonObject::new();
if http.s3_delete_objects(&bucket_name, &st, &json_resp).is_err() {
    println!("{}", http.last_error_text());
    return;
}

println!("Response status code = {}", http.last_status());

// Display the JSON response.
json_resp.set_emit_compact(false);
println!("{}", json_resp.emit().unwrap_or_default());