Skip to content

Commit 1f77124

Browse files
committed
initial commit
0 parents  commit 1f77124

File tree

1,604 files changed

+448961
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,604 files changed

+448961
-0
lines changed

.gitignore

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.*.sw[po]
2+
_build/
3+
setup.log
4+
setup.data
5+
*.native
6+
*.byte
7+
*#*
8+
*.core
9+
output/
10+
aws.docdir
11+
libraries/**/_build

.merlin

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
S lib
2+
S lib_test/**
3+
S libraries/**
4+
S src
5+
B _build/**
6+
PKG cohttp
7+
PKG core_kernel
8+
PKG ezxmlm
9+
PKG nocrypto
10+
PKG calendar
11+
PKG lwt
12+
PKG async
13+
PKG cmdliner
14+
PKG yojson
15+
PKG ppx_deriving
16+
PKG ppx_deriving.show
17+
PKG ppx_tools
18+
PKG ppx_tools.metaquot
19+
PKG ocamlgraph

LICENSE

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Copyright (c) 2016, Inhabited Type LLC
2+
3+
All rights reserved.
4+
5+
Redistribution and use in source and binary forms, with or without
6+
modification, are permitted provided that the following conditions
7+
are met:
8+
9+
1. Redistributions of source code must retain the above copyright
10+
notice, this list of conditions and the following disclaimer.
11+
12+
2. Redistributions in binary form must reproduce the above copyright
13+
notice, this list of conditions and the following disclaimer in the
14+
documentation and/or other materials provided with the distribution.
15+
16+
3. Neither the name of the author nor the names of his contributors
17+
may be used to endorse or promote products derived from this software
18+
without specific prior written permission.
19+
20+
THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY EXPRESS
21+
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23+
DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
24+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26+
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27+
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
28+
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
29+
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30+
POSSIBILITY OF SUCH DAMAGE.

Makefile

+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# OASIS_START
2+
# DO NOT EDIT (digest: a3c674b4239234cbbe53afe090018954)
3+
4+
SETUP = ocaml setup.ml
5+
6+
build: setup.data
7+
$(SETUP) -build $(BUILDFLAGS)
8+
9+
doc: setup.data build
10+
$(SETUP) -doc $(DOCFLAGS)
11+
12+
test: setup.data build
13+
$(SETUP) -test $(TESTFLAGS)
14+
15+
all:
16+
$(SETUP) -all $(ALLFLAGS)
17+
18+
install: setup.data
19+
$(SETUP) -install $(INSTALLFLAGS)
20+
21+
uninstall: setup.data
22+
$(SETUP) -uninstall $(UNINSTALLFLAGS)
23+
24+
reinstall: setup.data
25+
$(SETUP) -reinstall $(REINSTALLFLAGS)
26+
27+
clean:
28+
$(SETUP) -clean $(CLEANFLAGS)
29+
30+
distclean:
31+
$(SETUP) -distclean $(DISTCLEANFLAGS)
32+
33+
setup.data:
34+
$(SETUP) -configure $(CONFIGUREFLAGS)
35+
36+
configure:
37+
$(SETUP) -configure $(CONFIGUREFLAGS)
38+
39+
.PHONY: build doc test all install uninstall reinstall clean distclean configure
40+
41+
# OASIS_STOP
42+
43+
.PHONY: aws_ec2
44+
aws_ec2:
45+
./aws_gen.native --is-ec2 -i input/ec2/latest/service-2.json -r input/ec2/overrides.json -e input/errors.json -o libraries
46+
cd libraries/ec2 && oasis setup
47+
48+
# NOTE: This does not include aws_ec2, which is special-cased.
49+
LIBRARIES := \
50+
aws_autoscaling \
51+
aws_cloudformation \
52+
aws_cloudtrail \
53+
aws_elasticache \
54+
aws_elasticloadbalancing \
55+
aws_rds \
56+
aws_sdb \
57+
aws_ssm \
58+
aws_sts \
59+
60+
.PHONY: $(LIBRARIES)
61+
$(LIBRARIES): aws_%:
62+
./aws_gen.native -i input/$*/latest/service-2.json -r input/$*/overrides.json -e input/errors.json -o libraries
63+
cd libraries/$* && oasis setup
64+
65+
gen: all aws_ec2 $(LIBRARIES)
66+
67+
test-libraries: gen reinstall
68+
$(MAKE) -C libraries configure CONFIGUREFLAGS=--enable-tests test
69+
70+
install-libraries: gen reinstall
71+
$(MAKE) -C libraries build reinstall
72+
73+
clean-libraries:
74+
$(MAKE) -C libraries clean
75+
76+
enable-async:
77+
./configure --enable-async
78+
$(MAKE) -C libraries configure CONFIGUREFLAGS=--enable-async
79+
80+
enable-lwt:
81+
./configure --enable-lwt
82+
$(MAKE) -C libraries configure CONFIGUREFLAGS=--enable-lwt
83+
84+
disable-async:
85+
./configure --disable-async
86+
$(MAKE) -C libraries configure CONFIGUREFLAGS=--disable-async
87+
88+
disable-lwt:
89+
./configure --disable-lwt
90+
$(MAKE) -C libraries configure CONFIGUREFLAGS=--disable-lwt

README.md

+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# ocaml-aws
2+
3+
ocaml-aws is an Amazon Web Services SDK for OCaml. Its soruce distribution
4+
includes a core runtime API and a code generation tool that generates
5+
individual libraries from [botocore][] service descriptions.
6+
7+
[botocore]: https://github.com/boto/botocore
8+
9+
## Development
10+
11+
You can install the core library and its dependencies by pinning:
12+
13+
```bash
14+
opam pin add aws .
15+
```
16+
17+
After pinning, you can install to the latest development version by checking
18+
out the commit and running:
19+
20+
```bash
21+
opam update aws
22+
```
23+
24+
### Code Generation
25+
26+
To generate service libaries during development and in preparation for release,
27+
first configure the build to enable code generation and run the `gen` target of
28+
the Makefile. Note that the code generation tool has its own set of
29+
dependencies that must be installed in order for the build to succeed. See the
30+
`_oasis` file for details. In addition, the Makefile is written for GNU make.
31+
Some platforms such as OS X and FreeBSD do not have a GNU-compatible make
32+
installed by default. If you get strage error messages at this stage of the
33+
build, check your make.
34+
35+
```bash
36+
./configure --enable-gen
37+
make gen
38+
```
39+
40+
This should h
41+
42+
## Example
43+
44+
Here's how you use the library and EC2 bindings to retrieve a list of regions
45+
from AWS and print them to `stdout`. This example uses the Async runtime, but
46+
the equivalent lwt example is identical in structure.
47+
48+
```ocaml
49+
open Async.Std
50+
open Core.Std
51+
open Aws_ec2
52+
53+
let to_result = function
54+
| `Ok x -> Result.Ok x
55+
| `Error e -> Result.Error (Aws.Error.format Errors.to_string e)
56+
57+
let main () =
58+
Aws_async.Runtime.run_request
59+
~region:"us-east-1" ~access_key:"<...>" ~secret_key:"<...>"
60+
(module DescribeRegions)
61+
(Types.DescribeRegionsRequest.make ())
62+
>>| to_result >>| Option.value_exn
63+
>>|? List.iter ~f:(fun x -> Printf.printf "%s\n%!" x.Types.Region.region_name)
64+
>>> function
65+
| Result.Ok () -> exit 0
66+
| Result.Error e -> Printf.eprintf "%s\n%!" e; exit 1
67+
;;
68+
69+
Scheduler.go_main ~main ()
70+
```
71+
72+
### FreeBSD
73+
74+
In order to install the library dependencies&mdash;specifically zarith which is
75+
a transitive dependency of nocrypto&mdash;you must fist make the following
76+
modifications to your system and environment:
77+
78+
```bash
79+
# zarith asusmes an installation of gcc
80+
sudo ln /usr/bin/cc /usr/local/bin/gcc
81+
82+
# libgmp-associated files are installed in /usr/local, which is not in the
83+
# default search path for clang.
84+
export CLFAGS=-I/usr/local/include
85+
export LDFLAGS=-L/usr/local/lib
86+
```
87+
88+
## License
89+
90+
BSD3, see LICENSE file for its text.

_oasis

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
OASISFormat: 0.4
2+
Name: aws
3+
Version: 0.1.0
4+
Synopsis: Amazon Web Services SDK
5+
Maintainers: Spiros Eliopoulos <[email protected]>
6+
Authors: Spiros Eliopoulos <[email protected]>, Daniel Patterson <[email protected]>
7+
Homepage: https://github.com/inhabitedtype/ocaml-aws
8+
Copyrights: (C) 2016 Inhabited Type LLC
9+
License: BSD-3-clause
10+
Plugins: META (0.4), DevFiles (0.4)
11+
BuildTools: ocamlbuild
12+
13+
Flag lwt
14+
Description: Build the Lwt runtime
15+
Default: false
16+
17+
Flag async
18+
Description: Build the Async runtime
19+
Default: false
20+
21+
Flag gen
22+
Description: Build the code generation binary
23+
Default: false
24+
25+
Library aws
26+
Path: lib
27+
Findlibname: aws
28+
Modules: Aws
29+
BuildDepends: ezxmlm, nocrypto, calendar, uri
30+
31+
Document aws
32+
Title: aws Docs
33+
Type: ocamlbuild (0.4)
34+
BuildTools+: ocamldoc
35+
Install: false
36+
XOCamlbuildPath: lib
37+
XOCamlbuildLibraries: aws
38+
39+
Library aws_lwt
40+
Path: lwt
41+
Findlibname: lwt
42+
Findlibparent: aws
43+
Pack: true
44+
Build$: flag(lwt)
45+
Modules: Runtime
46+
BuildDepends: aws, cohttp.lwt-core, lwt, ssl
47+
48+
Library aws_async
49+
Path: async
50+
Findlibname: async
51+
Findlibparent: aws
52+
Pack: true
53+
Build$: flag(async)
54+
Modules: Runtime
55+
BuildDepends: aws, cohttp.async, async, async_ssl, threads
56+
57+
Executable aws_gen
58+
Path: src
59+
MainIs: aws_gen.ml
60+
Build$: flag(gen)
61+
Install: false
62+
CompiledObject: best
63+
BuildDepends: cmdliner, yojson, ppx_tools, ppx_tools.metaquot, ocamlgraph, unix

_tags

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# OASIS_START
2+
# DO NOT EDIT (digest: d2186fc32d7bb905a293e204af3a521a)
3+
# Ignore VCS directories, you can use the same kind of rule outside
4+
# OASIS_START/STOP if you want to exclude directories that contains
5+
# useless stuff for the build process
6+
true: annot, bin_annot
7+
<**/.svn>: -traverse
8+
<**/.svn>: not_hygienic
9+
".bzr": -traverse
10+
".bzr": not_hygienic
11+
".hg": -traverse
12+
".hg": not_hygienic
13+
".git": -traverse
14+
".git": not_hygienic
15+
"_darcs": -traverse
16+
"_darcs": not_hygienic
17+
# Library aws
18+
"lib/aws.cmxs": use_aws
19+
<lib/*.ml{,i,y}>: pkg_calendar
20+
<lib/*.ml{,i,y}>: pkg_ezxmlm
21+
<lib/*.ml{,i,y}>: pkg_nocrypto
22+
<lib/*.ml{,i,y}>: pkg_uri
23+
# Library aws_lwt
24+
"lwt/aws_lwt.cmxs": use_aws_lwt
25+
"lwt/runtime.cmx": for-pack(Aws_lwt)
26+
<lwt/*.ml{,i,y}>: pkg_calendar
27+
<lwt/*.ml{,i,y}>: pkg_cohttp.lwt-core
28+
<lwt/*.ml{,i,y}>: pkg_ezxmlm
29+
<lwt/*.ml{,i,y}>: pkg_lwt
30+
<lwt/*.ml{,i,y}>: pkg_nocrypto
31+
<lwt/*.ml{,i,y}>: pkg_ssl
32+
<lwt/*.ml{,i,y}>: pkg_uri
33+
<lwt/*.ml{,i,y}>: use_aws
34+
# Library aws_async
35+
"async/aws_async.cmxs": use_aws_async
36+
"async/runtime.cmx": for-pack(Aws_async)
37+
<async/*.ml{,i,y}>: pkg_async
38+
<async/*.ml{,i,y}>: pkg_async_ssl
39+
<async/*.ml{,i,y}>: pkg_calendar
40+
<async/*.ml{,i,y}>: pkg_cohttp.async
41+
<async/*.ml{,i,y}>: pkg_ezxmlm
42+
<async/*.ml{,i,y}>: pkg_nocrypto
43+
<async/*.ml{,i,y}>: pkg_threads
44+
<async/*.ml{,i,y}>: pkg_uri
45+
<async/*.ml{,i,y}>: use_aws
46+
# Executable aws_gen
47+
<src/aws_gen.{native,byte}>: pkg_cmdliner
48+
<src/aws_gen.{native,byte}>: pkg_ocamlgraph
49+
<src/aws_gen.{native,byte}>: pkg_ppx_tools
50+
<src/aws_gen.{native,byte}>: pkg_ppx_tools.metaquot
51+
<src/aws_gen.{native,byte}>: pkg_unix
52+
<src/aws_gen.{native,byte}>: pkg_yojson
53+
<src/*.ml{,i,y}>: pkg_cmdliner
54+
<src/*.ml{,i,y}>: pkg_ocamlgraph
55+
<src/*.ml{,i,y}>: pkg_ppx_tools
56+
<src/*.ml{,i,y}>: pkg_ppx_tools.metaquot
57+
<src/*.ml{,i,y}>: pkg_unix
58+
<src/*.ml{,i,y}>: pkg_yojson
59+
# OASIS_STOP
60+
"libraries": -traverse
61+
"libraries": not_hygienic

async/aws_async.mldylib

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# OASIS_START
2+
# DO NOT EDIT (digest: 8cb8fe9b041d7509f6a2d0e10f11b0b7)
3+
Aws_async
4+
# OASIS_STOP

async/aws_async.mllib

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# OASIS_START
2+
# DO NOT EDIT (digest: 8cb8fe9b041d7509f6a2d0e10f11b0b7)
3+
Aws_async
4+
# OASIS_STOP

async/aws_async.mlpack

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# OASIS_START
2+
# DO NOT EDIT (digest: bc366f2d0ba3d681e7a3899917c5d3de)
3+
Runtime
4+
# OASIS_STOP

0 commit comments

Comments
 (0)