Skip to content

Commit

Permalink
dynamodb
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Rochel committed Apr 27, 2021
1 parent ca48d0e commit c3b2d6e
Show file tree
Hide file tree
Showing 36 changed files with 5,909 additions and 0 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ LIBRARIES := \
aws-cloudformation \
aws-cloudtrail \
aws-cloudwatch \
aws-dynamodb \
aws-elasticache \
aws-elasticloadbalancing \
aws-rds \
Expand Down
21 changes: 21 additions & 0 deletions aws-dynamodb.opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
opam-version: "2.0"
maintainer: "Tim McGilchrist <timmcgil@gmail.com>"
authors: [ "Jan Rochel <jan@rochel.info>" ]
synopsis: "Amazon Web Services SDK bindings to Amazon DynamoDB"
description: "Amazon Web Services SDK bindings to Amazon DynamoDB"
version: "1.2"
license: "BSD-3-clause"
homepage: "https://github.com/inhabitedtype/ocaml-aws"
dev-repo: "git+https://github.com/inhabitedtype/ocaml-aws.git"
bug-reports: "https://github.com/inhabitedtype/ocaml-aws/issues"
doc: "https://github.com/inhabitedtype/ocaml-aws"
build: [
["dune" "subst"] {pinned}
["dune" "build" "-p" name "-j" jobs]
]
depends: [
"ocaml" {>= "4.08"}
"aws" {= version}
"dune" {>= "2.7"}
"ounit" {>= "2.2.4" & with-test}
]
1 change: 1 addition & 0 deletions input/dynamodb/latest
58 changes: 58 additions & 0 deletions libraries/dynamodb/lib/batchGetItem.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
open Types
open Aws
type input = BatchGetItemInput.t
type output = BatchGetItemOutput.t
type error = Errors_internal.t
let service = "dynamodb"
let signature_version = Request.V4
let to_http service region req =
let uri =
Uri.add_query_params
(Uri.of_string
(Aws.Util.of_option_exn (Endpoints.url_of service region)))
(List.append
[("Version", ["2012-08-10"]); ("Action", ["BatchGetItem"])]
(Util.drop_empty
(Uri.query_of_encoded
(Query.render (BatchGetItemInput.to_query req))))) in
(`POST, uri, [])
let of_http body =
try
let xml = Ezxmlm.from_string body in
let resp = Xml.member "BatchGetItemResponse" (snd xml) in
try
Util.or_error (Util.option_bind resp BatchGetItemOutput.parse)
(let open Error in
BadResponse
{
body;
message = "Could not find well formed BatchGetItemOutput."
})
with
| Xml.RequiredFieldMissing msg ->
let open Error in
`Error
(BadResponse
{
body;
message =
("Error parsing BatchGetItemOutput - missing field in body or children: "
^ msg)
})
with
| Failure msg ->
`Error
(let open Error in
BadResponse { body; message = ("Error parsing xml: " ^ msg) })
let parse_error code err =
let errors = [] @ Errors_internal.common in
match Errors_internal.of_string err with
| Some var ->
if
(List.mem var errors) &&
((match Errors_internal.to_http_code var with
| Some var -> var = code
| None -> true))
then Some var
else None
| None -> None
7 changes: 7 additions & 0 deletions libraries/dynamodb/lib/batchGetItem.mli
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
open Types
type input = BatchGetItemInput.t
type output = BatchGetItemOutput.t
type error = Errors_internal.t
include
Aws.Call with type input := input and type output := output and type
error := error
58 changes: 58 additions & 0 deletions libraries/dynamodb/lib/batchWriteItem.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
open Types
open Aws
type input = BatchWriteItemInput.t
type output = BatchWriteItemOutput.t
type error = Errors_internal.t
let service = "dynamodb"
let signature_version = Request.V4
let to_http service region req =
let uri =
Uri.add_query_params
(Uri.of_string
(Aws.Util.of_option_exn (Endpoints.url_of service region)))
(List.append
[("Version", ["2012-08-10"]); ("Action", ["BatchWriteItem"])]
(Util.drop_empty
(Uri.query_of_encoded
(Query.render (BatchWriteItemInput.to_query req))))) in
(`POST, uri, [])
let of_http body =
try
let xml = Ezxmlm.from_string body in
let resp = Xml.member "BatchWriteItemResponse" (snd xml) in
try
Util.or_error (Util.option_bind resp BatchWriteItemOutput.parse)
(let open Error in
BadResponse
{
body;
message = "Could not find well formed BatchWriteItemOutput."
})
with
| Xml.RequiredFieldMissing msg ->
let open Error in
`Error
(BadResponse
{
body;
message =
("Error parsing BatchWriteItemOutput - missing field in body or children: "
^ msg)
})
with
| Failure msg ->
`Error
(let open Error in
BadResponse { body; message = ("Error parsing xml: " ^ msg) })
let parse_error code err =
let errors = [] @ Errors_internal.common in
match Errors_internal.of_string err with
| Some var ->
if
(List.mem var errors) &&
((match Errors_internal.to_http_code var with
| Some var -> var = code
| None -> true))
then Some var
else None
| None -> None
7 changes: 7 additions & 0 deletions libraries/dynamodb/lib/batchWriteItem.mli
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
open Types
type input = BatchWriteItemInput.t
type output = BatchWriteItemOutput.t
type error = Errors_internal.t
include
Aws.Call with type input := input and type output := output and type
error := error
57 changes: 57 additions & 0 deletions libraries/dynamodb/lib/createTable.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
open Types
open Aws
type input = CreateTableInput.t
type output = CreateTableOutput.t
type error = Errors_internal.t
let service = "dynamodb"
let signature_version = Request.V4
let to_http service region req =
let uri =
Uri.add_query_params
(Uri.of_string
(Aws.Util.of_option_exn (Endpoints.url_of service region)))
(List.append [("Version", ["2012-08-10"]); ("Action", ["CreateTable"])]
(Util.drop_empty
(Uri.query_of_encoded
(Query.render (CreateTableInput.to_query req))))) in
(`POST, uri, [])
let of_http body =
try
let xml = Ezxmlm.from_string body in
let resp = Xml.member "CreateTableResponse" (snd xml) in
try
Util.or_error (Util.option_bind resp CreateTableOutput.parse)
(let open Error in
BadResponse
{
body;
message = "Could not find well formed CreateTableOutput."
})
with
| Xml.RequiredFieldMissing msg ->
let open Error in
`Error
(BadResponse
{
body;
message =
("Error parsing CreateTableOutput - missing field in body or children: "
^ msg)
})
with
| Failure msg ->
`Error
(let open Error in
BadResponse { body; message = ("Error parsing xml: " ^ msg) })
let parse_error code err =
let errors = [] @ Errors_internal.common in
match Errors_internal.of_string err with
| Some var ->
if
(List.mem var errors) &&
((match Errors_internal.to_http_code var with
| Some var -> var = code
| None -> true))
then Some var
else None
| None -> None
7 changes: 7 additions & 0 deletions libraries/dynamodb/lib/createTable.mli
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
open Types
type input = CreateTableInput.t
type output = CreateTableOutput.t
type error = Errors_internal.t
include
Aws.Call with type input := input and type output := output and type
error := error
55 changes: 55 additions & 0 deletions libraries/dynamodb/lib/deleteItem.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
open Types
open Aws
type input = DeleteItemInput.t
type output = DeleteItemOutput.t
type error = Errors_internal.t
let service = "dynamodb"
let signature_version = Request.V4
let to_http service region req =
let uri =
Uri.add_query_params
(Uri.of_string
(Aws.Util.of_option_exn (Endpoints.url_of service region)))
(List.append [("Version", ["2012-08-10"]); ("Action", ["DeleteItem"])]
(Util.drop_empty
(Uri.query_of_encoded
(Query.render (DeleteItemInput.to_query req))))) in
(`POST, uri, [])
let of_http body =
try
let xml = Ezxmlm.from_string body in
let resp = Xml.member "DeleteItemResponse" (snd xml) in
try
Util.or_error (Util.option_bind resp DeleteItemOutput.parse)
(let open Error in
BadResponse
{ body; message = "Could not find well formed DeleteItemOutput."
})
with
| Xml.RequiredFieldMissing msg ->
let open Error in
`Error
(BadResponse
{
body;
message =
("Error parsing DeleteItemOutput - missing field in body or children: "
^ msg)
})
with
| Failure msg ->
`Error
(let open Error in
BadResponse { body; message = ("Error parsing xml: " ^ msg) })
let parse_error code err =
let errors = [] @ Errors_internal.common in
match Errors_internal.of_string err with
| Some var ->
if
(List.mem var errors) &&
((match Errors_internal.to_http_code var with
| Some var -> var = code
| None -> true))
then Some var
else None
| None -> None
7 changes: 7 additions & 0 deletions libraries/dynamodb/lib/deleteItem.mli
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
open Types
type input = DeleteItemInput.t
type output = DeleteItemOutput.t
type error = Errors_internal.t
include
Aws.Call with type input := input and type output := output and type
error := error
57 changes: 57 additions & 0 deletions libraries/dynamodb/lib/deleteTable.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
open Types
open Aws
type input = DeleteTableInput.t
type output = DeleteTableOutput.t
type error = Errors_internal.t
let service = "dynamodb"
let signature_version = Request.V4
let to_http service region req =
let uri =
Uri.add_query_params
(Uri.of_string
(Aws.Util.of_option_exn (Endpoints.url_of service region)))
(List.append [("Version", ["2012-08-10"]); ("Action", ["DeleteTable"])]
(Util.drop_empty
(Uri.query_of_encoded
(Query.render (DeleteTableInput.to_query req))))) in
(`POST, uri, [])
let of_http body =
try
let xml = Ezxmlm.from_string body in
let resp = Xml.member "DeleteTableResponse" (snd xml) in
try
Util.or_error (Util.option_bind resp DeleteTableOutput.parse)
(let open Error in
BadResponse
{
body;
message = "Could not find well formed DeleteTableOutput."
})
with
| Xml.RequiredFieldMissing msg ->
let open Error in
`Error
(BadResponse
{
body;
message =
("Error parsing DeleteTableOutput - missing field in body or children: "
^ msg)
})
with
| Failure msg ->
`Error
(let open Error in
BadResponse { body; message = ("Error parsing xml: " ^ msg) })
let parse_error code err =
let errors = [] @ Errors_internal.common in
match Errors_internal.of_string err with
| Some var ->
if
(List.mem var errors) &&
((match Errors_internal.to_http_code var with
| Some var -> var = code
| None -> true))
then Some var
else None
| None -> None
7 changes: 7 additions & 0 deletions libraries/dynamodb/lib/deleteTable.mli
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
open Types
type input = DeleteTableInput.t
type output = DeleteTableOutput.t
type error = Errors_internal.t
include
Aws.Call with type input := input and type output := output and type
error := error
Loading

0 comments on commit c3b2d6e

Please sign in to comment.