package awsm-codegen
Install
Dune Dependency
Authors
Maintainers
Sources
md5=db5777910e155df33255f50c50daa046
sha512=18775715f99f5ba56c6dee40d7b4c4ab7f5d583327d2cc5c50d0cdae4c76c7b510e0ff974577cc0a9d82f497b979daf8af14f9e5741e9fbc5c83aa5928039c6b
README.md.html
README.md
awsm - OCaml AWS client
Pure OCaml client for AWS. Code is auto-generated for all services based on the API declared in botocore. Higher level functions are often implemented on top of this base, e.g. to support multi-part uploads to S3. Sub-libraries are provided for blocking, Async, and Lwt versions of all code.
Table of Contents
Features
Services | unix package | async package | lwt package |
---|---|---|---|
Amazon Athena (doc) | No | Yes | No |
Amazon Cognito (doc) | No | Yes | No |
Amazon EC2 (doc) | No | Yes | No |
Amazon ECR (doc) | No | Yes | No |
Amazon Glue (doc) | No | Yes | No |
Amazon IAM (doc) | No | Yes | No |
Amazon S3 (doc) | No | Yes | No |
Amazon SQS (doc) | No | Yes | No |
Cognito SRP | No | Yes | No |
Amazon STS (doc) | No | Yes | No |
Getting started
Install and build with local OPAM switch and lock file
Run the following commands to install a local OPAM switch based on OCaml 4.11.2 and install all package dependencies via OPAM. (Note that after running make we must also configure the local OPAM environment.)
make install-deps
eval $(opam env)
To actually build the project you are advised to lift system restrictions on stack size, because otherwise some files will fail to build due to stack overflows. On a modern Linux system you can wrap the invocation of make
under prlimit
:
prlimit --stack=unlimited make
Examples
Here is a short example where we use the S3 API to list the objects of the provided bucket (see amazon API).
open Awsm_async
open! Import
open IO
module S3 = Awsm_s3.Make (IO) (Http)
let pr = Caml.print_endline
let suite_main bucket () =
Cfg.get () >>= fun cfg ->
S3.listBuckets cfg >>= fun _ ->
S3.listObjects cfg (S3.ListObjectsRequest.make ~bucket ()) >>= function
| #S3.listObjects_error -> failwith "list objects error"
| `Ok response ->
Option.iter response.S3.ListObjectsOutput.name ~f:pr ;
let contents =
Option.value ~default:[] response.S3.ListObjectsOutput.contents
in
let on_object oo = Option.iter (oo.S3.Object.key :> string option) ~f:pr in
List.iter contents ~f:on_object ;
return ()
let suite_command =
Command.async_spec ~summary:"Test script"
Command.Spec.(empty +> anon ("bucket" %: string))
suite_main
let () =
Command.group ~summary:"Awsm test app" [("test-suite", suite_command)]
|> Command.run
More examples are available in the app directory.
Documentation
The documentation is available on https://opensource.solvuu.com/docs/awsm/api
To generate the awsm API documentation locally you need odoc
: opam install odoc
.
Then run make doc
.
License
Awsm is released under the ISC license.
How to contribute
See CONTRIBUTING for how to help out.