From ad5459683702f6fcd3bb3adc65483bad3e18464c Mon Sep 17 00:00:00 2001 From: Emil Lerch Date: Thu, 10 Jun 2021 14:35:22 -0700 Subject: [PATCH] wire Services through to aws.zig and main demo --- src/aws.zig | 8 ++++++++ src/main.zig | 5 +++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/aws.zig b/src/aws.zig index d6e5ec9..1d78cc0 100644 --- a/src/aws.zig +++ b/src/aws.zig @@ -11,8 +11,16 @@ pub const Options = struct { dualstack: bool = false, }; +/// Using this constant may blow up build times. Recommed using Services() +/// function directly, e.g. const services = Services(.{.sts, .ec2, .s3, .ddb}){}; pub const services = servicemodel.services; +/// Get a service model by importing specific services only. As an example: +/// const services = Services(.{.sts, .ec2, .s3, .ddb}){}; +/// +/// This will give you a constant with service data for sts, ec2, s3 and ddb only +pub const Services = servicemodel.Services; + pub const Aws = struct { allocator: *std.mem.Allocator, aws_http: awshttp.AwsHttp, diff --git a/src/main.zig b/src/main.zig index c8eb7cf..864af14 100644 --- a/src/main.zig +++ b/src/main.zig @@ -45,7 +45,8 @@ pub fn main() anyerror!void { var client = aws.Aws.init(allocator); defer client.deinit(); - const resp = try client.call(aws.services.sts.get_caller_identity.Request{}, options); + const services = aws.Services(.{.sts}){}; + const resp = try client.call(services.sts.get_caller_identity.Request{}, options); // TODO: This is a bit wonky. Root cause is lack of declarations in // comptime-generated types defer resp.deinit(); @@ -56,7 +57,7 @@ pub fn main() anyerror!void { var client2 = aws.Aws.init(allocator); defer client2.deinit(); - const resp2 = try client2.call(aws.services.sts.get_caller_identity.Request{}, options); // catch here and try alloc? + const resp2 = try client2.call(services.sts.get_caller_identity.Request{}, options); // catch here and try alloc? defer resp2.deinit(); }