GithubHelp home page GithubHelp logo

isabella232 / ocaml-aws Goto Github PK

View Code? Open in Web Editor NEW

This project forked from inhabitedtype/ocaml-aws

0.0 0.0 0.0 4.71 MB

Generated OCaml bindings for Amazon Web Services

License: Other

Makefile 0.04% OCaml 99.84% Shell 0.11%

ocaml-aws's Introduction

ocaml-aws

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

Build Status

Development

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

opam pin add aws .

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

opam update aws

Running individual test suites for a Service

AWS_ACCESS_KEY=???? \
AWS_SECRET_KEY=???? \
AWS_DEFAULT_REGION=ap-southeast-2 \
dune runtest libraries/ec2/lib_test

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. 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. The following commands will configure the build for code generation and regenerate the libraries from the current definitions:

# Compile code generator
make gen

# Compile generated libraries
make

Release

To generate a release to opam requires dune-release to be installed, then run:

make opam-release

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.

open Core
open Async
open Aws_ec2

let to_result = function
  | `Ok x    -> Ok x
  | `Error e -> 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 -> Log.Global.info "%s" x.Types.Region.region_name)
  >>> function
    | Ok ()   -> exit 0
    | Error e -> Log.Global.error "%s" e; exit 1

Scheduler.go_main ~main ()

DEBUGGING

If you get this error when running test or example code Fatal error: exception (Failure "No SSL or TLS support compiled into Conduit")

You need to install the ssl versions of your chosen async framework

opam install lwt_ssl async_ssl

License

BSD3, see LICENSE file for its text.

ocaml-aws's People

Contributors

abhi18av avatar anmonteiro avatar beajeanm avatar gtrak avatar hammer avatar justanotherdot avatar leonidas-from-xiv avatar seliopou avatar tmcgilchrist avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.