Compare commits
2 commits
6e34e83933
...
686b18d1f4
| Author | SHA1 | Date | |
|---|---|---|---|
| 686b18d1f4 | |||
| 742a820eeb |
3 changed files with 7 additions and 3 deletions
|
|
@ -6,6 +6,7 @@ const date = @import("date");
|
||||||
const json = @import("json");
|
const json = @import("json");
|
||||||
const zeit = @import("zeit");
|
const zeit = @import("zeit");
|
||||||
|
|
||||||
|
const credentials = @import("aws_credentials.zig");
|
||||||
const awshttp = @import("aws_http.zig");
|
const awshttp = @import("aws_http.zig");
|
||||||
const url = @import("url.zig");
|
const url = @import("url.zig");
|
||||||
const servicemodel = @import("servicemodel.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)
|
/// 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 {
|
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 signing = @import("aws_signing.zig");
|
||||||
const credentials = @import("aws_credentials.zig");
|
|
||||||
logs_off = off;
|
logs_off = off;
|
||||||
signing.logs_off = off;
|
signing.logs_off = off;
|
||||||
credentials.logs_off = off;
|
credentials.logs_off = off;
|
||||||
|
|
@ -84,6 +84,7 @@ pub const Options = struct {
|
||||||
dualstack: bool = false,
|
dualstack: bool = false,
|
||||||
success_http_code: i64 = 200,
|
success_http_code: i64 = 200,
|
||||||
client: Client,
|
client: Client,
|
||||||
|
credential_options: credentials.Options = .{},
|
||||||
|
|
||||||
diagnostics: ?*Diagnostics = null,
|
diagnostics: ?*Diagnostics = null,
|
||||||
|
|
||||||
|
|
@ -415,6 +416,7 @@ pub fn Request(comptime request_action: anytype) type {
|
||||||
.dualstack = options.dualstack,
|
.dualstack = options.dualstack,
|
||||||
.sigv4_service_name = Self.service_meta.sigv4_name,
|
.sigv4_service_name = Self.service_meta.sigv4_name,
|
||||||
.mock = options.mock,
|
.mock = options.mock,
|
||||||
|
.credential_options = options.credential_options,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
defer response.deinit();
|
defer response.deinit();
|
||||||
|
|
|
||||||
|
|
@ -408,7 +408,7 @@ fn getProfileCredentials(allocator: std.mem.Allocator, options: Profile) !?auth.
|
||||||
|
|
||||||
// Get active profile
|
// Get active profile
|
||||||
const profile = (try getEnvironmentVariable(allocator, "AWS_PROFILE")) orelse
|
const profile = (try getEnvironmentVariable(allocator, "AWS_PROFILE")) orelse
|
||||||
try allocator.dupe(u8, "default");
|
try allocator.dupe(u8, options.profile_name orelse "default");
|
||||||
defer allocator.free(profile);
|
defer allocator.free(profile);
|
||||||
log.debug("Looking for file credentials using profile '{s}'", .{profile});
|
log.debug("Looking for file credentials using profile '{s}'", .{profile});
|
||||||
log.debug("Checking credentials file: {s}", .{creds_file_path.evaluated_path});
|
log.debug("Checking credentials file: {s}", .{creds_file_path.evaluated_path});
|
||||||
|
|
|
||||||
|
|
@ -90,6 +90,8 @@ pub const Options = struct {
|
||||||
dualstack: bool = false,
|
dualstack: bool = false,
|
||||||
sigv4_service_name: ?[]const u8 = null,
|
sigv4_service_name: ?[]const u8 = null,
|
||||||
|
|
||||||
|
credential_options: credentials.Options = .{},
|
||||||
|
|
||||||
mock: ?Mock = null,
|
mock: ?Mock = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -186,7 +188,7 @@ pub const AwsHttp = struct {
|
||||||
defer endpoint.deinit();
|
defer endpoint.deinit();
|
||||||
log.debug("Calling endpoint {s}", .{endpoint.uri});
|
log.debug("Calling endpoint {s}", .{endpoint.uri});
|
||||||
// TODO: Should we allow customization here?
|
// 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();
|
defer creds.deinit();
|
||||||
const signing_config: signing.Config = .{
|
const signing_config: signing.Config = .{
|
||||||
.region = getRegion(service, options.region),
|
.region = getRegion(service, options.region),
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue