From 240d2ebdd18bfbce40c485f0bcc9fd9e65273fab Mon Sep 17 00:00:00 2001 From: Emil Lerch Date: Fri, 11 Feb 2022 09:17:27 -0800 Subject: [PATCH] new EC2 code (still failing/disabled) --- src/aws.zig | 17 +++++++++-------- src/main.zig | 7 +++++++ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/aws.zig b/src/aws.zig index 5c0bf42..e790872 100644 --- a/src/aws.zig +++ b/src/aws.zig @@ -193,15 +193,16 @@ pub fn Request(comptime action: anytype) type { }); defer options.client.allocator.free(query); - const body = if (Self.service_meta.aws_protocol == .query) + // Note: EC2 avoided the Action={s}&Version={s} in the body, but it's + // but it's required, so I'm not sure why that code was put in + // originally? + const body = try std.fmt.allocPrint(options.client.allocator, "Action={s}&Version={s}{s}{s}", .{ - action.action_name, - Self.service_meta.version, - continuation, - buffer.items, - }) - else // EC2 - try std.fmt.allocPrint(options.client.allocator, "{s}", .{buffer.items}); + action.action_name, + Self.service_meta.version, + continuation, + buffer.items, + }); defer options.client.allocator.free(body); return try Self.callAws(.{ .query = query, diff --git a/src/main.zig b/src/main.zig index f3d1fdf..43f0c97 100644 --- a/src/main.zig +++ b/src/main.zig @@ -169,8 +169,15 @@ pub fn main() anyerror!void { std.log.err("no functions to work with", .{}); } }, + // TODO: This test fails with broken LLVM module .ec2_query_no_input => { std.log.err("EC2 Test disabled due to compiler bug", .{}); + // Describe regions is a simpler request and easier to debug + // const instances = try client.call(services.ec2.describe_regions.Request{}, options); + // defer instances.deinit(); + // std.log.info("region count: {d}", .{instances.response.regions.?.len}); + + // Describe instances is more interesting // const instances = try client.call(services.ec2.describe_instances.Request{}, options); // defer instances.deinit(); // std.log.info("reservation count: {d}", .{instances.response.reservations.len});