From 5c29120a44a7ac537f0cd83e6958a89d481e5fdd Mon Sep 17 00:00:00 2001 From: Emil Lerch Date: Thu, 12 Aug 2021 17:51:47 -0700 Subject: [PATCH] initial json 1.1 support --- README.md | 3 ++- src/main.zig | 19 +++++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 4c5c5a5..99c190b 100644 --- a/README.md +++ b/README.md @@ -101,7 +101,8 @@ TODO List: (new 2021-05-29. I will proceed in this order unless I get other requests) * ✓ Implement [AWS query protocol](https://awslabs.github.io/smithy/1.0/spec/aws/aws-query-protocol.html). This is the protocol in use by sts.getcalleridentity. Total service count 18 * ✓ Implement [AWS Json 1.0 protocol](https://awslabs.github.io/smithy/1.0/spec/aws/aws-json-1_0-protocol.html). Includes dynamodb. Total service count 18 -* Implement [AWS Json 1.1 protocol](https://awslabs.github.io/smithy/1.0/spec/aws/aws-json-1_1-protocol.html). Includes ecs. Total service count 105 +* ✓ Implement [AWS Json 1.1 protocol](https://awslabs.github.io/smithy/1.0/spec/aws/aws-json-1_1-protocol.html). Includes ecs. Total service count 105 +* Implement [AWS Rest Json 1 protocol](https://awslabs.github.io/smithy/1.0/spec/aws/aws-restjson1-protocol.html). Includes lambda. Total service count 127 * Implement [AWS restXml protocol](https://awslabs.github.io/smithy/1.0/spec/aws/aws-restxml-protocol.html). Includes S3. Total service count 4. This may be blocked due to the same issue as EC2. * Implement [AWS EC2 query protocol](https://awslabs.github.io/smithy/1.0/spec/aws/aws-ec2-query-protocol.html). Includes EC2. Total service count 1. This is currently blocked, probably on self-hosted compiler coming in zig 0.9.0 (January 2022) due to compiler bug discovered. More details and llvm ir log can be found in the [XML branch](https://git.lerch.org/lobo/aws-sdk-for-zig/src/branch/xml). diff --git a/src/main.zig b/src/main.zig index 68cdc08..9fa87ec 100644 --- a/src/main.zig +++ b/src/main.zig @@ -29,6 +29,8 @@ const Tests = enum { ec2_query_no_input, json_1_0_query_with_input, json_1_0_query_no_input, + json_1_1_query_with_input, + json_1_1_query_no_input, }; pub fn main() anyerror!void { @@ -67,7 +69,7 @@ pub fn main() anyerror!void { var client = aws.Aws.init(allocator); defer client.deinit(); - const services = aws.Services(.{ .sts, .ec2, .dynamo_db }){}; + const services = aws.Services(.{ .sts, .ec2, .dynamo_db, .ecs }){}; for (tests.items) |t| { std.log.info("===== Start Test: {s} =====", .{@tagName(t)}); @@ -89,7 +91,6 @@ pub fn main() anyerror!void { std.log.info("access key: {s}", .{access.response.credentials.?.access_key_id}); }, .json_1_0_query_with_input => { - // TODO: Find test without sensitive info const tables = try client.call(services.dynamo_db.list_tables.Request{ .limit = 1, }, options); @@ -102,6 +103,20 @@ pub fn main() anyerror!void { defer limits.deinit(); std.log.info("account read capacity limit: {d}", .{limits.response.account_max_read_capacity_units}); }, + .json_1_1_query_with_input => { + const clusters = try client.call(services.ecs.list_clusters.Request{ + .max_results = 1, + }, options); + defer clusters.deinit(); + std.log.info("request id: {s}", .{clusters.response_metadata.request_id}); + std.log.info("account has clusters: {b}", .{clusters.response.cluster_arns.?.len > 0}); + }, + .json_1_1_query_no_input => { + const clusters = try client.call(services.ecs.list_clusters.Request{}, options); + defer clusters.deinit(); + std.log.info("request id: {s}", .{clusters.response_metadata.request_id}); + std.log.info("account has clusters: {b}", .{clusters.response.cluster_arns.?.len > 0}); + }, .ec2_query_no_input => { std.log.err("EC2 Test disabled due to compiler bug", .{}); // const instances = try client.call(services.ec2.describe_instances.Request{}, options);