Giter Club home page Giter Club logo

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.

API Documentation

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_ID=???? \
AWS_SECRET_ACCESS_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 dependabot[bot] avatar hammer avatar justanotherdot avatar leonidas-from-xiv avatar nymphium avatar seliopou avatar tmcgilchrist avatar zbaylin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ocaml-aws's Issues

Fixup scripts for doing release to OPAM

The old scripts use oasis query and depend on an oasis directory layout.
These need to be ported to deal with the new dune layout and be fully automated.
Our options are:

  1. Use topkg, atd repo has some instructions https://github.com/mjambon/atd/blob/be57549f4035d4d52a928b29542f5df9563acbe2/internal-doc/README.md
  2. Use dune-release
  3. Use opam publish

Initial investigation of dune-release suggests it doesn't handle multiple packages from a single repository very well. Most of the commands seem to make this assumption.

Not sure how to install and use the library

I tried to install the library using opam which somehow succeed but leaves me with only two modules Aws and Aws_lwt. How can I arrange so that material found in libraries/ is also compiled and installed?

Also, I am a bit confused by the whole library/ directory. If I understand correctly, its content is generated by the aws_gen program. But why add this to the SCM system?

Thanks!

Integration tests for CI

Setup circleci or travis with the correct AWS permissions to run integration tests again AWS.

I have some circleci setup for other OCaml projects that might be useful.

Bonus would be to have a cleanup stage post CI so we don't leave any hanging resources around that cost me $$$$.

breaking change in yojson causing build to fail

Version 2.0.0 of yojson removed biniou, which causes the compiler error below. There is a lower bound on yojson in the opam files, but no upper bound. Pinning yojson locally to 1.7.0 allows the build to work for me.

File "src/endpoints_j.ml", line 40, characters 11-13:
  40 |   write__2 ob x;
Error: This expression has type Bi_outbuf.t
       but an expression was expected of type Buffer.t

Library `aws-ec2` has a module impossible to use??

The module "name" has a "dash:"

ocaml# #require "aws-ec2";;
ocaml# open Aws_ec2;;
Error: Unbound module Aws_ec2
 $ ls `ocamlfind query aws-ec2`/*.cmi
/home/smondet/.opam/4.03.0/lib/aws-ec2/aws-ec2.cmi
 $ ocamlobjinfo `ocamlfind query aws-ec2`/*.cma
File /home/smondet/.opam/4.03.0/lib/aws-ec2/aws-ec2.cma
Force custom: no
Extra C object files:
Extra C options:
Extra dynamically-loaded libraries:
Unit name: Aws-ec2
Interfaces imported:
	711e5c0d799e5bc2329ebf7485a79aec	Aws-ec2
	8511e1de84e74c17dacc88c35f5be478	Xmlm
	f17596e00890cdbfa772cbc596b3ec17	Uri
	331e41ad213579d006efd84f19005bd5	Unix
	c9608ce7bf745054a217110dcaac126e	Sys
	c28a3ca42a30c6ffa0bbab4a05329226	String
	fc4cd9c73967ba1a8bc6360b21cf5f3a	Str
	0b2cb4ad5159673670474028f5fac7a6	Sexplib
	f665d1463ac108184ac6ad6d8bac076e	Random
	0145d8daf24f9afd43ffac3c376fa3c4	Printf
	999b28e3b7638771c87eebf5a8325e42	Pervasives
	ecf089d7539fcff97623be26ecebf193	Nativeint
	ac5f6095cc0a546330ada0df0986a497	List
	330cec55af19abb867bbde7885b2588f	Lexing
	b2e565a5cdbd351dc15bc9061d30c458	Lazy
	8deb8d60f2294e2f3dc6971e7f2efba2	Int64
	d0de3bfd44513ff6fd70cbf476e9fa55	Int32
	049026f8240c3b61bd91f719b0f55877	Hashtbl
	60c2e7663dd57d13b5920931742e1c10	Format
	701e80504b28ac51442bbd6cb8925d28	Ezxmlm
	def386d89a071f0355f7bda7e3a074fd	Complex
	4a517d12500bc3789093103f6fee94bf	Char
	9642e3ed163e46770985ca668738ed5f	CamlinternalFormatBasics
	d2b09586c51f5e3c7bc0527bd55f0b38	CalendarLib
	6dc691300ced97c0e319cbcc0a715044	Bytes
	3bd1af04573ce2da7fc3dc04403e852e	Buffer
	7cb259b8efbf4550648d25651a3342ee	Bigarray
	0d57ddf07f596b30b0d744c01f7d0bd7	Aws
Uses unsafe features: no
Force link: no
 $ opam show aws-ec2
             package: aws-ec2
             version: 0.1.0
          repository: default
        upstream-url: https://github.com/inhabitedtype/ocaml-aws/releases/download/aws-1.0.2/aws-ec2-0.1.0.tar.gz
       upstream-kind: http
   upstream-checksum: 22eee043b576df98b095f508b440a846
            homepage: https://github.com/inhabitedtype/ocaml-aws
         bug-reports: https://github.com/inhabitedtype/ocaml-aws/issues
            dev-repo: https://github.com/inhabitedtype/ocaml-aws.git
              author: Spiros Eliopoulos <[email protected]>, Daniel Patterson <[email protected]>
             license: BSD-3-clause
             depends: aws >= 0.1.0 & ocamlfind
   installed-version: 0.1.0 [4.03.0]
   available-version: 0.1.0
         description: Amazon Elastic Compute Cloud

Endpoint error for all S3 requests

I am trying to use the S3 API. I tried both ListObjects and GetObjects.

For both, the result is the same - the answer from the server is not the one expected:

<?xml version="1.0" encoding="UTF-8"?>
<ListAllMyBucketsResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
...
</ListAllMyBucketsResult>

Vs

<?xml version="1.0" encoding="UTF-8"?>
<GetObjectOutput>
...
</GetObjectOutput>

Here is the code I use:

let downloadFile = (filename) => {
  let settings = Config.settings;

  let run_request =
    Aws_lwt.Runtime.run_request(
      ~access_key=settings.accessKey,
      ~secret_key=settings.secretKey,
      ~region=settings.region,
      (module Aws_s3.GetObject),
      Aws_s3.Types.GetObjectRequest.make(
        ~bucket=settings.bucket,
        ~key=filename,
        (),
      ),
    );

  Lwt_main.run(run_request);
};

Where settings.bucket = "bucket-name" and settings.region = "us-east-1".

When reading the documentation, I am under the impression that the host endpoint to target should be:
bucket-name.s3.amazonaws.com, but from what I see, the library targets s3.amazonaws.com, which might explain issue.

Version 1.2.1 features and fixes

  • Bump lower bound to 4.08 to include Uri 4.1 fixes for escaping #104
  • Generate AWS Lambda #108
  • Migrate CI to github actions #104
  • Need AWS Lambda tests and example usage
  • Align ENV variable usage with official AWS client usage #111
  • Include AWS documentation for services in generated code
  • Bump ppx_tools_versioned lower bound to 4.08, Better option to remove the dependency #126
  • Support for signing requests with assume_role tokens #117
  • Add KMS support #118

In the interests of visibility these are the pieces I'm working on for the next minor release of ocaml-aws.

EDIT
Removing the aws-lambda support from this release, it requires a larger re-write than I expected.

SQS support

I've been working on adding SQS support to this library and I ran into a some code in generate.ml that seems to assume all service url's are of the format:

(app1 "Uri.of_string" (str ("https://" ^ service ^ ".amazonaws.com")))

There needs to be a bit more logic to this, as the endpoints aren't really consistent, documented here: https://docs.aws.amazon.com/general/latest/gr/rande.html

I see the _endpoints.json file in the input directory and I'm thinking that by grabbing an updated version from boto, it could be used to generate an Endpoint module which would allow the appropriate url creation logic to be applied per service/region.

I have been mucking around with fixing some issues in the enum generator and ran into this. If wanted, I can probably pop open a wip PR for both items in a day or so.

Yojson deprecation warnings

Should be simple enough to fix if someone wants to dig into this:

Error (warning 3): deprecated: Yojson.Basic.json
json types are being renamed and will be removed in the next Yojson major version. Use type t instead
File "src/reading.mli", line 36, characters 18-35:
Error (warning 3): deprecated: Yojson.Basic.json
json types are being renamed and will be removed in the next Yojson major version. Use type t instead
File "src/reading.mli", line 38, characters 22-39:
Error (warning 3): deprecated: Yojson.Basic.json
json types are being renamed and will be removed in the next Yojson major version. Use type t instead```

S3

Are there any plans to support working with S3 directly? Or does that exist already in the library/libraries somewhere?

Missing result module for ec2?

Simple code for describeimagesresult

  | `Ok r ->
    let (b : Yojson.Basic.json) =
      Aws_ec2.Types.DescribeImagesResult.to_json r
    in
    Yojson.Basic.pretty_to_string b
    |> Lwt_io.printl
  | `Error oops ->
    Aws.Error.format Aws_ec2.Errors.to_string oops |> Lwt_io.printl

I need something similar for Aws_ec2.CreateVolume, currently have:

let do_run =
  let (access_key, secret_key) = keys () in
  Aws_lwt.Runtime.run_request
    (* Need to pick the appropriate region, won't work with a wrong
         region *)
    ~region:"us-east-1"
    ~access_key
    ~secret_key

let do_create_volume () =
  do_run
    (module Aws_ec2.CreateVolume)
    (Aws_ec2.Types.CreateVolumeRequest.make
       ~dry_run:true
       ~availability_zone:"us-east-1"
       ()) >>= function
  | `Ok r ->
.... But Aws_ec2.Types.CreateVolumeResult does not exist.
  | `Error oops ->
    Lwt_io.printl "Done"

So how can I get a result? I understand the code is auto generated but does that mean that the ec2 bindings are incomplete at the moment?

Version 2.0

Next major release

  • Rewritten code generation based of ppxlib directly.

Support for temporary credentials

When trying to use the ocaml-aws library, I couldn't figure out a way to supply temporary credentials using the API as it is. What I needed to support temporary credentials, was to add a "x-amz-security-token" header with a supplied token. I think it might be as easy as adding an optional parameter to sign_request that will add the appropriate header, but I think that would then need to be surfaced in places that is being called, like Aws_async.Runtime.run_request.

More info on temporary credentials:
-Making Requests
-REST authentication

Switch to jbuilder

This will make it possible to reuse a single source distribution for all the different libraries.

[opam] upper bound on cohttp

In the opam repository of this package (https://opam.ocaml.org/packages/aws/) there is an upper version limit (implemented as a conflict) on the cohttp package:

conflicts: [
  "cohttp" {< "0.17.0"}
  "cohttp" {>="0.99"}
]

Is there any good reason for this? Everything compiles just fine for me with cohttp.2.5.4.

Error with new aws-ec2 generated bindings

I was upgrading one of my projects that uses this project and attempted to update it to use the new ec2 bindings that were generated in 4c69f5e that were generated with the files from but there appears to be an issue with them.

It looks like a difference in the the generated Types.*. to_query function. In the older version , the initial character of the keys were lowercase but the new version 4c69f5e has it as uppercase. This causes keys to not be recognized as valid by AWS and the request to be rejected. I quickly checked the schema for 2015-04-15 vs 2016-11-15 and it doesn't look like a difference in there.

I think the next steps are to look at the code that was changed in the code generation in between these two generations but I haven't had time to do so and I wanted to document this error so other people could be aware. The old bindings still work well so I've just pinned those for the moment. When I get sometime in the next couple weeks, I'll attempt to spend more time on this.

Support S3

  • Add S3 generation and tests back into master (Revert #92)
  • Fix deserialisation. The current working implementations from Haskell and python, skip the root element and look for it's children. While the OCaml looks for the root element to be named as outlined in the service definition.

Where are the modules

Thanks for this! I had a similar idea a year ago but wasn't good enough at that time to make it work.

Installed a fresh copy directly via pinning, using lwt, and I'm not getting the Aws_ec2 module. At the top level I only get Aws, Aws_lwt and Aws_gen.

More SDK bindings?

It looks to me that this library only supports a couple AWS services.

  1. Am I wrong and things like S3 are supported already?

  2. Are there plans to add more services as the library grows?

  3. Unrelated question: can I install from opam with the lwt runtime support?

Unable to send JSON payload for SQS messages

I'm attempting to send an SQS message, where the payload is JSON data and it's failing. The specific error "AWS query cannot have multiple values for same key" (which appears to be from here).

With an invocation like

Aws_async.Runtime.run_request ~region ~access_key ~secret_key
    (module SendMessage)
   (Types.SendMessageRequest.make ~queue_url:(Uri.to_string queue_url) ~message_body:message ())

Where message is a JSON document in a string. To reproduce the issue, any JSON map with more than one keypair would work, so something like:

{"a": 1, "b": 2}

Doing some debugging, it looks like this code is where the request is getting broken:

(Uri.query_of_encoded
               (Query.render (SendMessageRequest.to_query req)))

It is using the Uri library to encode the message into a query string, which has some issues when encoding things for AWS (see mirage/ocaml-uri#65). What it looks like is happening here is that it's treating the commas as the query key having multiple values. That causes the "AWS query cannot have multiple values for the same key" error and also causes the JSON document to become invalid.

Project Status

I'm considering trying to spend my own time to get this library to a more polished state for our own company's use. It seems like a few PR's have languished, and I'm wondering about LOE to get it more feature-complete. Is there anything specific blocking work here or is it just a lot of details?

Compilation fails for Ocaml 4.03.0

➜  ocaml-aws git:(master) make gen                                       
ocaml setup.ml -all 
File "./setup.ml", line 318, characters 20-36:
Warning 3: deprecated: String.lowercase
Use String.lowercase_ascii instead.
File "./setup.ml", line 318, characters 42-58:
Warning 3: deprecated: String.lowercase
Use String.lowercase_ascii instead.
File "./setup.ml", line 327, characters 14-30:
Warning 3: deprecated: String.lowercase
Use String.lowercase_ascii instead.
File "./setup.ml", line 327, characters 38-54:
Warning 3: deprecated: String.lowercase
Use String.lowercase_ascii instead.
File "./setup.ml", line 330, characters 25-41:
Warning 3: deprecated: String.lowercase
Use String.lowercase_ascii instead.
File "./setup.ml", line 368, characters 10-26:
Warning 3: deprecated: String.lowercase
Use String.lowercase_ascii instead.
File "./setup.ml", line 474, characters 13-29:
Warning 3: deprecated: String.lowercase
Use String.lowercase_ascii instead.
File "./setup.ml", line 1825, characters 16-33:
Warning 3: deprecated: String.capitalize
Use String.capitalize_ascii instead.
File "./setup.ml", line 1831, characters 16-35:
Warning 3: deprecated: String.uncapitalize
Use String.uncapitalize_ascii instead.
File "setup.ml", line 5847, characters 11-28:
Warning 3: deprecated: String.capitalize
Use String.capitalize_ascii instead.
File "setup.ml", line 5848, characters 11-30:
Warning 3: deprecated: String.uncapitalize
Use String.uncapitalize_ascii instead.

Configuration: 
ocamlfind: ........................................... /home/kstarikov/.opam/4.03.0/bin/ocamlfind
ocamlc: .............................................. /home/kstarikov/.opam/4.03.0/bin/ocamlc.opt
ocamlopt: ............................................ /home/kstarikov/.opam/4.03.0/bin/ocamlopt.opt
ocamlbuild: .......................................... /home/kstarikov/.opam/4.03.0/bin/ocamlbuild
Package name: ........................................ aws
Package version: ..................................... 1.0.2
os_type: ............................................. Unix
system: .............................................. linux
architecture: ........................................ amd64
ccomp_type: .......................................... cc
ocaml_version: ....................................... 4.03.0
standard_library_default: ............................ /home/kstarikov/.opam/4.03.0/lib/ocaml
standard_library: .................................... /home/kstarikov/.opam/4.03.0/lib/ocaml
standard_runtime: .................................... /home/kstarikov/.opam/4.03.0/bin/ocamlrun
bytecomp_c_compiler: ................................. gcc -std=gnu99 -O2 -fno-strict-aliasing -fwrapv -Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT -fPIC
native_c_compiler: ................................... gcc -std=gnu99 -O2 -fno-strict-aliasing -fwrapv -Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT
model: ............................................... default
ext_obj: ............................................. .o
ext_asm: ............................................. .s
ext_lib: ............................................. .a
ext_dll: ............................................. .so
default_executable_name: ............................. a.out
systhread_supported: ................................. true
Install architecture-independent files dir: .......... /usr/local
Install architecture-dependent files in dir: ......... $prefix
User executables: .................................... $exec_prefix/bin
System admin executables: ............................ $exec_prefix/sbin
Program executables: ................................. $exec_prefix/libexec
Read-only single-machine data: ....................... $prefix/etc
Modifiable architecture-independent data: ............ $prefix/com
Modifiable single-machine data: ...................... $prefix/var
Object code libraries: ............................... $exec_prefix/lib
Read-only arch-independent data root: ................ $prefix/share
Read-only architecture-independent data: ............. $datarootdir
Info documentation: .................................. $datarootdir/info
Locale-dependent data: ............................... $datarootdir/locale
Man documentation: ................................... $datarootdir/man
Documentation root: .................................. $datarootdir/doc/$pkg_name
HTML documentation: .................................. $docdir
DVI documentation: ................................... $docdir
PDF documentation: ................................... $docdir
PS documentation: .................................... $docdir
findlib_version: ..................................... 1.6.2
is_native: ........................................... true
suffix_program: ...................................... 
Remove a file.: ...................................... rm -f
Remove a directory.: ................................. rm -rf
Turn ocaml debug flag on: ............................ true
Turn ocaml profile flag on: .......................... false
Compiler support generation of .cmxs.: ............... true
OCamlbuild additional flags: ......................... 
Build the Lwt runtime: ............................... false
Build the Async runtime: ............................. false
Build the code generation tool: ...................... true
Create documentations: ............................... true
Compile tests executable and library and run them: ... false
pkg_ezxmlm: .......................................... /home/kstarikov/.opam/4.03.0/lib/ezxmlm
pkg_nocrypto: ........................................ /home/kstarikov/.opam/4.03.0/lib/nocrypto
pkg_calendar: ........................................ /home/kstarikov/.opam/4.03.0/lib/calendar
pkg_uri: ............................................. /home/kstarikov/.opam/4.03.0/lib/uri
ocamldoc: ............................................ /home/kstarikov/.opam/4.03.0/bin/ocamldoc
pkg_cmdliner: ........................................ /home/kstarikov/.opam/4.03.0/lib/cmdliner
pkg_yojson: .......................................... /home/kstarikov/.opam/4.03.0/lib/yojson
pkg_ppx_tools: ....................................... /home/kstarikov/.opam/4.03.0/lib/ppx_tools
pkg_ppx_tools_metaquot: .............................. /home/kstarikov/.opam/4.03.0/lib/ppx_tools
pkg_ocamlgraph: ...................................... /home/kstarikov/.opam/4.03.0/lib/ocamlgraph
pkg_unix: ............................................ /home/kstarikov/.opam/4.03.0/lib/ocaml

Finished, 0 targets (0 cached) in 00:00:00.
+ /home/kstarikov/.opam/4.03.0/bin/ocamlfind ocamlc -c -g -annot -bin-annot -package yojson -package unix -package ppx_tools.metaquot -package ppx_tools -package ocamlgraph -package cmdliner -I src -o src/syntax.cmo src/syntax.ml
File "src/syntax.ml", line 61, characters 13-112:
Error: This variant expression is expected to have type Asttypes.rec_flag
       The constructor :: does not belong to type Asttypes.rec_flag
Command exited with code 2.
Compilation unsuccessful after building 23 targets (21 cached) in 00:00:00.
E: Failure("Command ''/home/kstarikov/.opam/4.03.0/bin/ocamlbuild' lib/aws.cma lib/aws.cmxa lib/aws.a lib/aws.cmxs src/aws_gen.native -use-ocamlfind -tag debug' terminated with error code 10")
make: *** [all] Error 1

Tests for generated libraries

There are a few tests for ec2 but it would be great to have more tests across the rest of the libraries.

Current state of basic runnable tests:

  • Autoscaling
  • SQS - In progress #73
  • S3
  • EC2
  • cloudformation
  • cloudwatch
  • elasticloadbalancing
  • RDS
  • STS
  • cloudtrail
  • dynamodb
  • elasticache
  • elasticmapreduce
  • route53
  • SDB - Blocked by V2 request signing #74
  • SSM

Error installing library from opam

I can't seem to install the package from opam, am I missing something?

$ opam pin add aws .
aws is now path-pinned to /Users/fredlhsu/code/ocaml

[aws] /Users/fredlhsu/code/ocaml/ synchronized

aws needs to be installed.
The following actions will be performed:
  ∗  install calendar      2.03.2             [required by aws]
  ∗  install mirage-no-xen 1                  [required by nocrypto]
  ∗  install conf-gmp      1                  [required by zarith]
  ∗  install xmlm          1.2.0              [required by ezxmlm]
  ∗  install zarith        1.4.1              [required by nocrypto]
  ∗  install ezxmlm        1.0.1              [required by aws]
  ∗  install nocrypto      0.5.2              [required by aws]
  ∗  install aws           1.0.0*
===== ∗  8 =====
Do you want to continue ? [Y/n] y

=-=- Gathering sources =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=  🐫
[aws.1.0.0] /Users/fredlhsu/code/ocaml/ already up-to-date
[default] https://opam.ocaml.org/archives/ezxmlm.1.0.1+opam.tar.gz downloaded
[default] https://opam.ocaml.org/archives/calendar.2.03.2+opam.tar.gz downloaded
[default] https://opam.ocaml.org/archives/xmlm.1.2.0+opam.tar.gz downloaded
[default] https://opam.ocaml.org/archives/zarith.1.4.1+opam.tar.gz downloaded
[default] https://opam.ocaml.org/archives/nocrypto.0.5.2+opam.tar.gz downloaded

=-=- Processing actions -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=  🐫
∗  installed mirage-no-xen.1
∗  installed conf-gmp.1
∗  installed xmlm.1.2.0
∗  installed calendar.2.03.2
∗  installed zarith.1.4.1
∗  installed ezxmlm.1.0.1
∗  installed nocrypto.0.5.2
[ERROR] The compilation of aws failed at "ocaml setup.ml -configure --prefix
        /Users/fredlhsu/.opam/4.01.0 --enable-lwt --disable-async".
Processing  8/8: [aws: ocamlfind remove]
#=== ERROR while installing aws.1.0.0 =========================================#
# opam-version 1.2.2
# os           darwin
# command      ocaml setup.ml -configure --prefix /Users/fredlhsu/.opam/4.01.0 --enable-lwt --disable-async
# path         /Users/fredlhsu/.opam/4.01.0/build/aws.1.0.0
# compiler     4.01.0
# exit-code    2
# env-file     /Users/fredlhsu/.opam/4.01.0/build/aws.1.0.0/aws-53720-a7c577.env
# stdout-file  /Users/fredlhsu/.opam/4.01.0/build/aws.1.0.0/aws-53720-a7c577.out
# stderr-file  /Users/fredlhsu/.opam/4.01.0/build/aws.1.0.0/aws-53720-a7c577.err
### stderr ###
# Cannot find file setup.ml.



=-=- Error report -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=  🐫
The following actions failed
  ∗  install aws 1.0.0
The following changes have been performed
  ∗  install calendar      2.03.2
  ∗  install conf-gmp      1
  ∗  install ezxmlm        1.0.1
  ∗  install mirage-no-xen 1
  ∗  install nocrypto      0.5.2
  ∗  install xmlm          1.2.0
  ∗  install zarith        1.4.1
[NOTE] Pinning command successful, but your installed packages may be out of
       sync.

The former state can be restored with:
    opam switch import "~/.opam/4.01.0/backup/state-20170418172309.export"```

Error while building aws-rds

Pinned to master, for opam install aws-rds I get:

+ /home/smondet/.opam/4.03.0/bin/ocamlfind ocamlc -c -g -annot -bin-annot -package aws -I lib -o lib/describeAccountAttributes.cmi lib/describeAccountAttributes.mli
File "lib/describeAccountAttributes.mli", line 2, characters 13-47:
Error: Unbound module DescribeAccountAttributesMessage
Command exited with code 2.

Respect `protocol` in service description files

The sort of a request / response body is based on protocol in a service description file.
For example, the field in DynamoDB description file is "json" and each body of requests / response is JSON, whereas the field in EC2 is "ec2" and each of bodies is XML.
Then, Content-Type header follows the request body (already described #60 (comment)).
Especially the version of x-amz-json is corresponding to jsonVersion field in a service description file.

The current implementation encodes query to URL parameter, doesn't send body, and parses response as XML.
It is not valid in json-protocol services.

Auth/signature problem with `Aws_sdb`

With this:

let region = "us-east-1" in
let access_key =  env_exn "AWS_KEY_ID" in
let secret_key =  env_exn "AWS_SECRET_KEY" in
Aws_lwt.Runtime.run_request
  ~region ~access_key ~secret_key
  (module Aws_sdb.CreateDomain)
  (Aws_sdb.Types.CreateDomainRequest.make
     ~domain_name:"smondet-test" ())

I get

HttpError(401 - AwsError): [AuthFailure: AWS was not able to authenticate the request: access credentials are missing]

but the exact same credentials work well with the Aws_ec2 module.

And with AWS-CLI: aws sdb create-domain --domain-name smondet-test0 also works.


Aws.sign_request
seems to be using “Version 4” of the protocol.

And issue aws/aws-sdk-cpp#372
says that SDB is using “Version 2”?

And this doc
http://docs.aws.amazon.com/AmazonSimpleDB/latest/DeveloperGuide/HMACAuth.html
seems to confirm:

This section describes how to create the signature. The method described in
the following procedure is known as signature version 2, and uses the
HMAC-SHA256 signing method.

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.