add credential options to aws options so profile can be passed
This commit is contained in:
parent
6e34e83933
commit
742a820eeb
2 changed files with 6 additions and 2 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();
|
||||||
|
|
|
||||||
|
|
@ -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