Sample code for 30+ languages & platforms
Zig

Wasabi Delete Bucket

See more Wasabi Examples

Demonstrates how to delete a new Wasabi bucket.

Chilkat Zig Downloads

Zig
const std = @import("std");
const chilkat = @import("chilkat");

pub fn main(init: std.process.Init) !void {
    const alloc = init.arena.allocator();

    var success: bool = false;

    // This example assumes 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");

    // To delete a bucket located in a different region, use the domain for that region, such as "s3.eu-central-1.wasabisys.com"
    http.setAwsEndpoint("s3.wasabisys.com");

    http.setKeepResponseBody(true);

    success = if (http.s3DeleteBucket("chilkat-wasabi-testbucket")) true else |_| false;
    if (!success) {
        std.debug.print("{s}\n", .{try http.getLastErrorText(alloc)});
        // Also examine the error response body from Wasabi:
        std.debug.print("{s}\n", .{try http.getLastResponseBody(alloc)});
    } else {
        std.debug.print("Bucket deleted.\n", .{});
    }
}