Rust Requires Chilkat v11.0.0+
Rust
S3 Delete Multiple Objects
See more Amazon S3 Examples
Demonstrates how to delete multiple objects in a single HTTP request.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("ABQXXABC83ABCDEFVQXX");
// Insert your secret key here:
http.set_aws_secret_key("XXXXYYYYabcdABCD12345678xxxxyyyyzzzz");
let bucket_name = "chilkattestbucket".to_string();
let object_name1 = "starfish.jpg".to_string();
// Delete a particular version of this object:
let object_name2 = "conch.jpg; VersionId=\"3/L4kqtJlcpXroDTDmJ+rmSpXd3dIbrHY+MTRCxf3vjVBH40Nr8X8gdRQBpUMLUo\"".to_string();
let object_name3 = "seaUrchin.jpg".to_string();
let st = chilkat::StringTable::new();
let _ = st.append(&object_name1);
let _ = st.append(&object_name2);
let _ = st.append(&object_name3);
let json_resp = chilkat::JsonObject::new();
if http.s3_delete_objects(&bucket_name, &st, &json_resp).is_err() {
println!("{}", http.last_error_text());
return;
}
// Display the JSON response.
json_resp.set_emit_compact(false);
println!("{}", json_resp.emit().unwrap_or_default());