diff --git a/src/aws.zig b/src/aws.zig index e2cc7f3..d6e5ec9 100644 --- a/src/aws.zig +++ b/src/aws.zig @@ -6,7 +6,10 @@ const servicemodel = @import("servicemodel.zig"); const log = std.log.scoped(.aws); -pub const Options = awshttp.Options; +pub const Options = struct { + region: []const u8 = "aws-global", + dualstack: bool = false, +}; pub const services = servicemodel.services; @@ -39,7 +42,16 @@ pub const Aws = struct { log.debug("service sigv4 name {s}", .{service.sigv4_name}); log.debug("version {s}", .{service.version}); log.debug("action {s}", .{action.action_name}); - const response = try self.aws_http.callApi(action_info.service, service.version, action.action_name, options); + const response = try self.aws_http.callApi( + service.endpoint_prefix, + service.version, + action.action_name, + .{ + .region = options.region, + .dualstack = options.dualstack, + .sigv4_service_name = service.sigv4_name, + }, + ); defer response.deinit(); // TODO: Check status code for badness var stream = json.TokenStream.init(response.body); diff --git a/src/awshttp.zig b/src/awshttp.zig index f8b17a6..3e38b22 100644 --- a/src/awshttp.zig +++ b/src/awshttp.zig @@ -67,9 +67,10 @@ pub const AwsError = error{ pub const Options = struct { region: []const u8 = "aws-global", dualstack: bool = false, + sigv4_service_name: ?[]const u8 = null, }; -pub const SigningOptions = struct { +const SigningOptions = struct { region: []const u8 = "aws-global", service: []const u8, }; @@ -240,7 +241,7 @@ pub const AwsHttp = struct { httplog.debug("Calling {s}.{s}, endpoint {s}", .{ service, action, endpoint.uri }); const signing_options: SigningOptions = .{ .region = options.region, - .service = service, + .service = if (options.sigv4_service_name) |name| name else service, }; return try self.makeRequest(endpoint, "POST", "/", body, signing_options); }