Zig Requires Chilkat v11.0.0+
Zig
Generate S3 Signed URL
See more Amazon S3 Examples
Demonstrates how to generate a pre-signed S3 URL.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 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("AWS_ACCESS_KEY");
// Insert your secret key here:
http.setAwsSecretKey("AWS_SECRET_KEY");
http.setAwsRegion("us-west-2");
http.setAwsEndpoint("s3-us-west-2.amazonaws.com");
const bucket_name = "chilkattest";
const path = "starfish.jpg";
const signed_url = http.s3GenPresignedUrl(alloc, "GET", true, bucket_name, path, 3600, "s3") catch {
std.debug.print("{s}\n", .{try http.getLastErrorText(alloc)});
return;
};
std.debug.print("{s}\n", .{signed_url});
}