Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
seliopou committed Jan 11, 2016
0 parents commit 1f77124
Show file tree
Hide file tree
Showing 1,604 changed files with 448,961 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.*.sw[po]
_build/
setup.log
setup.data
*.native
*.byte
*#*
*.core
output/
aws.docdir
libraries/**/_build
19 changes: 19 additions & 0 deletions .merlin
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
S lib
S lib_test/**
S libraries/**
S src
B _build/**
PKG cohttp
PKG core_kernel
PKG ezxmlm
PKG nocrypto
PKG calendar
PKG lwt
PKG async
PKG cmdliner
PKG yojson
PKG ppx_deriving
PKG ppx_deriving.show
PKG ppx_tools
PKG ppx_tools.metaquot
PKG ocamlgraph
30 changes: 30 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Copyright (c) 2016, Inhabited Type LLC

All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

3. Neither the name of the author nor the names of his contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY EXPRESS
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
90 changes: 90 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# OASIS_START
# DO NOT EDIT (digest: a3c674b4239234cbbe53afe090018954)

SETUP = ocaml setup.ml

build: setup.data
$(SETUP) -build $(BUILDFLAGS)

doc: setup.data build
$(SETUP) -doc $(DOCFLAGS)

test: setup.data build
$(SETUP) -test $(TESTFLAGS)

all:
$(SETUP) -all $(ALLFLAGS)

install: setup.data
$(SETUP) -install $(INSTALLFLAGS)

uninstall: setup.data
$(SETUP) -uninstall $(UNINSTALLFLAGS)

reinstall: setup.data
$(SETUP) -reinstall $(REINSTALLFLAGS)

clean:
$(SETUP) -clean $(CLEANFLAGS)

distclean:
$(SETUP) -distclean $(DISTCLEANFLAGS)

setup.data:
$(SETUP) -configure $(CONFIGUREFLAGS)

configure:
$(SETUP) -configure $(CONFIGUREFLAGS)

.PHONY: build doc test all install uninstall reinstall clean distclean configure

# OASIS_STOP

.PHONY: aws_ec2
aws_ec2:
./aws_gen.native --is-ec2 -i input/ec2/latest/service-2.json -r input/ec2/overrides.json -e input/errors.json -o libraries
cd libraries/ec2 && oasis setup

# NOTE: This does not include aws_ec2, which is special-cased.
LIBRARIES := \
aws_autoscaling \
aws_cloudformation \
aws_cloudtrail \
aws_elasticache \
aws_elasticloadbalancing \
aws_rds \
aws_sdb \
aws_ssm \
aws_sts \

.PHONY: $(LIBRARIES)
$(LIBRARIES): aws_%:
./aws_gen.native -i input/$*/latest/service-2.json -r input/$*/overrides.json -e input/errors.json -o libraries
cd libraries/$* && oasis setup

gen: all aws_ec2 $(LIBRARIES)

test-libraries: gen reinstall
$(MAKE) -C libraries configure CONFIGUREFLAGS=--enable-tests test

install-libraries: gen reinstall
$(MAKE) -C libraries build reinstall

clean-libraries:
$(MAKE) -C libraries clean

enable-async:
./configure --enable-async
$(MAKE) -C libraries configure CONFIGUREFLAGS=--enable-async

enable-lwt:
./configure --enable-lwt
$(MAKE) -C libraries configure CONFIGUREFLAGS=--enable-lwt

disable-async:
./configure --disable-async
$(MAKE) -C libraries configure CONFIGUREFLAGS=--disable-async

disable-lwt:
./configure --disable-lwt
$(MAKE) -C libraries configure CONFIGUREFLAGS=--disable-lwt
90 changes: 90 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# ocaml-aws

ocaml-aws is an Amazon Web Services SDK for OCaml. Its soruce distribution
includes a core runtime API and a code generation tool that generates
individual libraries from [botocore][] service descriptions.

[botocore]: https://github.com/boto/botocore

## Development

You can install the core library and its dependencies by pinning:

```bash
opam pin add aws .
```

After pinning, you can install to the latest development version by checking
out the commit and running:

```bash
opam update aws
```

### Code Generation

To generate service libaries during development and in preparation for release,
first configure the build to enable code generation and run the `gen` target of
the Makefile. Note that the code generation tool has its own set of
dependencies that must be installed in order for the build to succeed. See the
`_oasis` file for details. In addition, the Makefile is written for GNU make.
Some platforms such as OS X and FreeBSD do not have a GNU-compatible make
installed by default. If you get strage error messages at this stage of the
build, check your make.

```bash
./configure --enable-gen
make gen
```

This should h

## Example

Here's how you use the library and EC2 bindings to retrieve a list of regions
from AWS and print them to `stdout`. This example uses the Async runtime, but
the equivalent lwt example is identical in structure.

```ocaml
open Async.Std
open Core.Std
open Aws_ec2
let to_result = function
| `Ok x -> Result.Ok x
| `Error e -> Result.Error (Aws.Error.format Errors.to_string e)
let main () =
Aws_async.Runtime.run_request
~region:"us-east-1" ~access_key:"<...>" ~secret_key:"<...>"
(module DescribeRegions)
(Types.DescribeRegionsRequest.make ())
>>| to_result >>| Option.value_exn
>>|? List.iter ~f:(fun x -> Printf.printf "%s\n%!" x.Types.Region.region_name)
>>> function
| Result.Ok () -> exit 0
| Result.Error e -> Printf.eprintf "%s\n%!" e; exit 1
;;
Scheduler.go_main ~main ()
```

### FreeBSD

In order to install the library dependencies&mdash;specifically zarith which is
a transitive dependency of nocrypto&mdash;you must fist make the following
modifications to your system and environment:

```bash
# zarith asusmes an installation of gcc
sudo ln /usr/bin/cc /usr/local/bin/gcc

# libgmp-associated files are installed in /usr/local, which is not in the
# default search path for clang.
export CLFAGS=-I/usr/local/include
export LDFLAGS=-L/usr/local/lib
```

## License

BSD3, see LICENSE file for its text.
63 changes: 63 additions & 0 deletions _oasis
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
OASISFormat: 0.4
Name: aws
Version: 0.1.0
Synopsis: Amazon Web Services SDK
Maintainers: Spiros Eliopoulos <[email protected]>
Authors: Spiros Eliopoulos <[email protected]>, Daniel Patterson <[email protected]>
Homepage: https://github.com/inhabitedtype/ocaml-aws
Copyrights: (C) 2016 Inhabited Type LLC
License: BSD-3-clause
Plugins: META (0.4), DevFiles (0.4)
BuildTools: ocamlbuild

Flag lwt
Description: Build the Lwt runtime
Default: false

Flag async
Description: Build the Async runtime
Default: false

Flag gen
Description: Build the code generation binary
Default: false

Library aws
Path: lib
Findlibname: aws
Modules: Aws
BuildDepends: ezxmlm, nocrypto, calendar, uri

Document aws
Title: aws Docs
Type: ocamlbuild (0.4)
BuildTools+: ocamldoc
Install: false
XOCamlbuildPath: lib
XOCamlbuildLibraries: aws

Library aws_lwt
Path: lwt
Findlibname: lwt
Findlibparent: aws
Pack: true
Build$: flag(lwt)
Modules: Runtime
BuildDepends: aws, cohttp.lwt-core, lwt, ssl

Library aws_async
Path: async
Findlibname: async
Findlibparent: aws
Pack: true
Build$: flag(async)
Modules: Runtime
BuildDepends: aws, cohttp.async, async, async_ssl, threads

Executable aws_gen
Path: src
MainIs: aws_gen.ml
Build$: flag(gen)
Install: false
CompiledObject: best
BuildDepends: cmdliner, yojson, ppx_tools, ppx_tools.metaquot, ocamlgraph, unix
61 changes: 61 additions & 0 deletions _tags
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# OASIS_START
# DO NOT EDIT (digest: d2186fc32d7bb905a293e204af3a521a)
# Ignore VCS directories, you can use the same kind of rule outside
# OASIS_START/STOP if you want to exclude directories that contains
# useless stuff for the build process
true: annot, bin_annot
<**/.svn>: -traverse
<**/.svn>: not_hygienic
".bzr": -traverse
".bzr": not_hygienic
".hg": -traverse
".hg": not_hygienic
".git": -traverse
".git": not_hygienic
"_darcs": -traverse
"_darcs": not_hygienic
# Library aws
"lib/aws.cmxs": use_aws
<lib/*.ml{,i,y}>: pkg_calendar
<lib/*.ml{,i,y}>: pkg_ezxmlm
<lib/*.ml{,i,y}>: pkg_nocrypto
<lib/*.ml{,i,y}>: pkg_uri
# Library aws_lwt
"lwt/aws_lwt.cmxs": use_aws_lwt
"lwt/runtime.cmx": for-pack(Aws_lwt)
<lwt/*.ml{,i,y}>: pkg_calendar
<lwt/*.ml{,i,y}>: pkg_cohttp.lwt-core
<lwt/*.ml{,i,y}>: pkg_ezxmlm
<lwt/*.ml{,i,y}>: pkg_lwt
<lwt/*.ml{,i,y}>: pkg_nocrypto
<lwt/*.ml{,i,y}>: pkg_ssl
<lwt/*.ml{,i,y}>: pkg_uri
<lwt/*.ml{,i,y}>: use_aws
# Library aws_async
"async/aws_async.cmxs": use_aws_async
"async/runtime.cmx": for-pack(Aws_async)
<async/*.ml{,i,y}>: pkg_async
<async/*.ml{,i,y}>: pkg_async_ssl
<async/*.ml{,i,y}>: pkg_calendar
<async/*.ml{,i,y}>: pkg_cohttp.async
<async/*.ml{,i,y}>: pkg_ezxmlm
<async/*.ml{,i,y}>: pkg_nocrypto
<async/*.ml{,i,y}>: pkg_threads
<async/*.ml{,i,y}>: pkg_uri
<async/*.ml{,i,y}>: use_aws
# Executable aws_gen
<src/aws_gen.{native,byte}>: pkg_cmdliner
<src/aws_gen.{native,byte}>: pkg_ocamlgraph
<src/aws_gen.{native,byte}>: pkg_ppx_tools
<src/aws_gen.{native,byte}>: pkg_ppx_tools.metaquot
<src/aws_gen.{native,byte}>: pkg_unix
<src/aws_gen.{native,byte}>: pkg_yojson
<src/*.ml{,i,y}>: pkg_cmdliner
<src/*.ml{,i,y}>: pkg_ocamlgraph
<src/*.ml{,i,y}>: pkg_ppx_tools
<src/*.ml{,i,y}>: pkg_ppx_tools.metaquot
<src/*.ml{,i,y}>: pkg_unix
<src/*.ml{,i,y}>: pkg_yojson
# OASIS_STOP
"libraries": -traverse
"libraries": not_hygienic
4 changes: 4 additions & 0 deletions async/aws_async.mldylib
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# OASIS_START
# DO NOT EDIT (digest: 8cb8fe9b041d7509f6a2d0e10f11b0b7)
Aws_async
# OASIS_STOP
4 changes: 4 additions & 0 deletions async/aws_async.mllib
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# OASIS_START
# DO NOT EDIT (digest: 8cb8fe9b041d7509f6a2d0e10f11b0b7)
Aws_async
# OASIS_STOP
4 changes: 4 additions & 0 deletions async/aws_async.mlpack
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# OASIS_START
# DO NOT EDIT (digest: bc366f2d0ba3d681e7a3899917c5d3de)
Runtime
# OASIS_STOP
Loading

0 comments on commit 1f77124

Please sign in to comment.