From 742a820eebc5f2d447307d7b0c3afcf751398a21 Mon Sep 17 00:00:00 2001 From: Emil Lerch Date: Mon, 2 Feb 2026 16:11:03 -0800 Subject: [PATCH] add credential options to aws options so profile can be passed --- src/aws.zig | 4 +++- src/aws_http.zig | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/aws.zig b/src/aws.zig index cf318e2..0afdd97 100644 --- a/src/aws.zig +++ b/src/aws.zig @@ -6,6 +6,7 @@ const date = @import("date"); const json = @import("json"); const zeit = @import("zeit"); +const credentials = @import("aws_credentials.zig"); const awshttp = @import("aws_http.zig"); const url = @import("url.zig"); const servicemodel = @import("servicemodel.zig"); @@ -19,7 +20,6 @@ const scoped_log = std.log.scoped(.aws); /// controls are insufficient (e.g. use in build script) pub fn globalLogControl(aws_level: std.log.Level, http_level: std.log.Level, signing_level: std.log.Level, off: bool) void { const signing = @import("aws_signing.zig"); - const credentials = @import("aws_credentials.zig"); logs_off = off; signing.logs_off = off; credentials.logs_off = off; @@ -84,6 +84,7 @@ pub const Options = struct { dualstack: bool = false, success_http_code: i64 = 200, client: Client, + credential_options: credentials.Options = .{}, diagnostics: ?*Diagnostics = null, @@ -415,6 +416,7 @@ pub fn Request(comptime request_action: anytype) type { .dualstack = options.dualstack, .sigv4_service_name = Self.service_meta.sigv4_name, .mock = options.mock, + .credential_options = options.credential_options, }, ); defer response.deinit(); diff --git a/src/aws_http.zig b/src/aws_http.zig index bf14d1d..89fefb4 100644 --- a/src/aws_http.zig +++ b/src/aws_http.zig @@ -90,6 +90,8 @@ pub const Options = struct { dualstack: bool = false, sigv4_service_name: ?[]const u8 = null, + credential_options: credentials.Options = .{}, + mock: ?Mock = null, }; @@ -186,7 +188,7 @@ pub const AwsHttp = struct { defer endpoint.deinit(); log.debug("Calling endpoint {s}", .{endpoint.uri}); // TODO: Should we allow customization here? - const creds = try credentials.getCredentials(self.allocator, .{}); + const creds = try credentials.getCredentials(self.allocator, options.credential_options); defer creds.deinit(); const signing_config: signing.Config = .{ .region = getRegion(service, options.region),