2023-08-04 16:38:25 +00:00
|
|
|
AWS SDK for Zig
|
|
|
|
===============
|
2021-04-27 18:24:01 +00:00
|
|
|
|
2023-02-26 05:11:43 +00:00
|
|
|
[![Build Status](https://actions-status.lerch.org/lobo/aws-sdk-for-zig/build)](https://git.lerch.org/lobo/aws-sdk-for-zig/actions?workflow=build.yaml&state=closed)
|
2022-01-11 19:19:40 +00:00
|
|
|
|
2023-08-27 19:12:04 +00:00
|
|
|
Current executable size for the demo is 980k after compiling with -Doptimize=ReleaseSmall
|
|
|
|
in x86_linux, and will vary based on services used. Tested targets:
|
2022-01-20 20:18:47 +00:00
|
|
|
|
|
|
|
* x86_64-linux
|
|
|
|
* riscv64-linux
|
|
|
|
* aarch64-linux
|
2022-01-20 20:31:45 +00:00
|
|
|
* x86_64-windows
|
2022-01-20 20:18:47 +00:00
|
|
|
* arm-linux
|
2022-02-09 06:36:36 +00:00
|
|
|
* aarch64-macos
|
|
|
|
* x86_64-macos
|
2021-04-27 18:24:01 +00:00
|
|
|
|
2022-02-09 06:36:36 +00:00
|
|
|
Tested targets are built, but not continuously tested, by CI.
|
2022-01-20 20:31:45 +00:00
|
|
|
|
2023-08-04 16:38:25 +00:00
|
|
|
Building
|
|
|
|
--------
|
2021-04-27 18:24:01 +00:00
|
|
|
|
2023-08-27 19:12:04 +00:00
|
|
|
`zig build` should work. It will build the code generation project, fetch model
|
|
|
|
files from upstream AWS Go SDK v2, run the code generation, then build the main
|
|
|
|
project with the generated code. Testing can be done with `zig test`.
|
|
|
|
|
|
|
|
Note that there are some loose ends on this version as compared to the [0.9.0
|
|
|
|
branch](https://git.lerch.org/lobo/aws-sdk-for-zig/src/branch/0.9.0). More
|
|
|
|
details below in Limitations. This branch overall is superior, as is the 0.11
|
|
|
|
compiler, but if you need an edge case and don't want to issue a PR, feel free
|
|
|
|
to use that branch.
|
|
|
|
|
|
|
|
Using
|
|
|
|
-----
|
2021-04-27 18:24:01 +00:00
|
|
|
|
2023-08-27 19:12:04 +00:00
|
|
|
This is designed for use with the Zig 0.11 package manager, and exposes a module
|
|
|
|
called "aws". Set up `build.zig.zon` and add the dependency/module to your project
|
|
|
|
as normal and the package manager should do its thing.
|
2021-04-27 18:24:01 +00:00
|
|
|
|
2023-08-27 19:12:04 +00:00
|
|
|
Running the demo
|
|
|
|
----------------
|
2021-04-27 18:24:01 +00:00
|
|
|
|
2022-01-11 19:19:40 +00:00
|
|
|
This library mimics the aws c libraries for it's work, so it operates like most
|
|
|
|
other 'AWS things'. main.zig gives you a handful of examples for working with services.
|
2021-04-27 18:24:01 +00:00
|
|
|
For local testing or alternative endpoints, there's no real standard, so
|
|
|
|
there is code to look for `AWS_ENDPOINT_URL` environment variable that will
|
2022-01-20 15:41:35 +00:00
|
|
|
supersede all other configuration. Note that an alternative endpoint may
|
|
|
|
require passing in a client option to specify an different TLS root certificate
|
|
|
|
(pass null to disable certificate verification).
|
|
|
|
|
2023-08-27 19:12:04 +00:00
|
|
|
An [old branch based on aws-crt](https://github.com/elerch/aws-sdk-for-zig/tree/aws-crt) exists
|
|
|
|
for posterity, and supports x86_64 linux. The old branch is deprecated, so if
|
|
|
|
there are issues you see that work correctly in the aws-crt branch, please
|
|
|
|
file an issue.
|
2021-04-27 18:24:01 +00:00
|
|
|
|
2023-08-04 16:38:25 +00:00
|
|
|
Limitations
|
|
|
|
-----------
|
2022-01-20 03:37:17 +00:00
|
|
|
|
2022-06-29 16:24:16 +00:00
|
|
|
WebIdentityToken is not yet implemented.
|
2022-01-20 03:37:17 +00:00
|
|
|
|
2021-04-27 18:24:01 +00:00
|
|
|
TODO List:
|
|
|
|
|
2023-08-27 19:12:04 +00:00
|
|
|
* re-enable all demos. Some are causing compilation errors, and these errors
|
|
|
|
do not have reference tracing as they exist within monomorphised code
|
|
|
|
* Implement all demos as tests in src/aws.zig. This has been done for
|
|
|
|
STS GetCallerIdentity, but needs to be extended for the others
|
|
|
|
* Json parsing is based on a fork of the 0.9.0 (maybe earlier?) json parser.
|
|
|
|
Upgrading to 0.11 caused some commenting of things that probably broke some
|
|
|
|
stuff. JSON parsing in general needs a re-visit. Note also that a json.zig
|
|
|
|
file is embedded/copied from the codegen project, so that also needs a second
|
|
|
|
look.
|
|
|
|
* Take a look to see about compilation speed. With codegen caching this is
|
|
|
|
reasonable, but still takes longer than needed.
|
|
|
|
* Upgrade the model files. This is a simple tasks, but I'd like the first
|
|
|
|
item on this list to be completed first.
|
2022-01-11 19:19:40 +00:00
|
|
|
* Implement sigv4a signing
|
2022-02-10 17:45:18 +00:00
|
|
|
* Implement jitter/exponential backoff
|
|
|
|
* Implement timeouts and other TODO's in the code
|
|
|
|
* Add option to cache signature keys
|
2021-04-27 18:24:01 +00:00
|
|
|
|
|
|
|
Compiler wishlist/watchlist:
|
|
|
|
|
|
|
|
* [comptime allocations](https://github.com/ziglang/zig/issues/1291) so we can read files, etc (or is there another way)
|