wire Services through to aws.zig and main demo
This commit is contained in:
parent
7f8ddd3461
commit
ad54596837
|
@ -11,8 +11,16 @@ pub const Options = struct {
|
||||||
dualstack: bool = false,
|
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;
|
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 {
|
pub const Aws = struct {
|
||||||
allocator: *std.mem.Allocator,
|
allocator: *std.mem.Allocator,
|
||||||
aws_http: awshttp.AwsHttp,
|
aws_http: awshttp.AwsHttp,
|
||||||
|
|
|
@ -45,7 +45,8 @@ pub fn main() anyerror!void {
|
||||||
|
|
||||||
var client = aws.Aws.init(allocator);
|
var client = aws.Aws.init(allocator);
|
||||||
defer client.deinit();
|
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
|
// TODO: This is a bit wonky. Root cause is lack of declarations in
|
||||||
// comptime-generated types
|
// comptime-generated types
|
||||||
defer resp.deinit();
|
defer resp.deinit();
|
||||||
|
@ -56,7 +57,7 @@ pub fn main() anyerror!void {
|
||||||
|
|
||||||
var client2 = aws.Aws.init(allocator);
|
var client2 = aws.Aws.init(allocator);
|
||||||
defer client2.deinit();
|
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();
|
defer resp2.deinit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user