Rust Requires Chilkat v11.0.0+
Rust
Wasabi Delete Bucket Objects
See more Wasabi Examples
Demonstrates how to delete one or more objects in a bucket.Chilkat Rust Downloads
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
let http = chilkat::Http::new();
// Insert your access key here:
http.set_aws_access_key("access-key");
// Insert your secret key here:
http.set_aws_secret_key("secret-key");
// Use the endpoint matching the bucket's region.
http.set_aws_endpoint("s3.us-west-1.wasabisys.com");
let bucket_name = "chilkattest".to_string();
let object_name1 = "seahorse.jpg".to_string();
let object_name2 = "seahorse2.jpg".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());