Zig Requires Chilkat v11.0.0+
Zig
Wasabi Delete Bucket Objects
See more Wasabi Examples
Demonstrates how to delete one or more objects in a bucket.Chilkat Zig Downloads
const std = @import("std");
const chilkat = @import("chilkat");
pub fn main(init: std.process.Init) !void {
const alloc = init.arena.allocator();
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
const http = try chilkat.Http.init();
defer http.deinit();
// Insert your access key here:
http.setAwsAccessKey("access-key");
// Insert your secret key here:
http.setAwsSecretKey("secret-key");
// Use the endpoint matching the bucket's region.
http.setAwsEndpoint("s3.us-west-1.wasabisys.com");
const bucket_name = "chilkattest";
const object_name1 = "seahorse.jpg";
const object_name2 = "seahorse2.jpg";
const st = try chilkat.StringTable.init();
defer st.deinit();
st.append(object_name1) catch {};
st.append(object_name2) catch {};
const json_resp = try chilkat.JsonObject.init();
defer json_resp.deinit();
http.s3DeleteObjects(bucket_name, st, json_resp) catch {
std.debug.print("{s}\n", .{try http.getLastErrorText(alloc)});
return;
};
std.debug.print("Response status code = {d}\n", .{http.getLastStatus()});
// Display the JSON response.
json_resp.setEmitCompact(false);
std.debug.print("{s}\n", .{try json_resp.emit(alloc)});
}