Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AWS lambda #108

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
Unreleased
1.2.1
----------

- Add KMS support (#118 @zbaylin)
- Drop dependency on ocaml-migrate-parsetree and use ocaml-compiler-libs (#126 @Nymphium)

1.2.1
----------
- Increase lower bound on OCaml to 4.08. https://github.com/inhabitedtype/ocaml-aws/pull/104
- Migrate CI to github actions https://github.com/inhabitedtype/ocaml-aws/pull/104
- Add STS `assume_role` token support https://github.com/inhabitedtype/ocaml-aws/pull/117
- Increase lower bound on OCaml to 4.08. (#104 @tmcgilchrist)
- Migrate CI to github actions (#104 @tmcgilchrist)
- Add STS `assume_role` token support (#117 @zbaylin @UnrealAkama @bleepbloopsify)
- Initial AWS Lambda support (#108 @tmcgilchrist)

1.2: (24-01-2020)
----------
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ LIBRARIES := \
aws-sts \
aws-route53 \
aws-sqs \
aws-lambda \

.PHONY: $(LIBRARIES)
$(LIBRARIES): aws-%:
Expand Down
22 changes: 22 additions & 0 deletions aws-lambda.opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
opam-version: "2.0"
maintainer: "Tim McGilchrist <timmcgil@gmail.com>"
authors: [ "Spiros Eliopoulos <spiros@inhabitedtype.com>"
"Daniel Patterson <dbp@dbpmail.net>"
"Tim McGilchrist <timmcgil@gmail.com>"
]
synopsis: "Amazon Web Services SDK bindings to AWS Lambda"
description: "Amazon Web Services SDK bindings to AWS Lambda"
version: "1.1"
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"] {dev}
["dune" "build" "-p" name "-j" jobs]
]
depends: [
"aws" {>= version}
"dune" {>= "2.7"}
]
1 change: 1 addition & 0 deletions input/lambda/latest
58 changes: 58 additions & 0 deletions libraries/lambda/lib/addPermission.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
open Types
open Aws
type input = AddPermissionRequest.t
type output = AddPermissionResponse.t
type error = Errors_internal.t
let service = "lambda"
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", ["2015-03-31"]); ("Action", ["AddPermission"])]
(Util.drop_empty
(Uri.query_of_encoded
(Query.render (AddPermissionRequest.to_query req))))) in
(`POST, uri, [])
let of_http body =
try
let xml = Ezxmlm.from_string body in
let resp = Xml.member "AddPermissionResponse" (snd xml) in
try
Util.or_error (Util.option_bind resp AddPermissionResponse.parse)
(let open Error in
BadResponse
{
body;
message = "Could not find well formed AddPermissionResponse."
})
with
| Xml.RequiredFieldMissing msg ->
let open Error in
`Error
(BadResponse
{
body;
message =
("Error parsing AddPermissionResponse - 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/lambda/lib/addPermission.mli
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
open Types
type input = AddPermissionRequest.t
type output = AddPermissionResponse.t
type error = Errors_internal.t
include
Aws.Call with type input := input and type output := output and type
error := error
61 changes: 61 additions & 0 deletions libraries/lambda/lib/createEventSourceMapping.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
open Types
open Aws
type input = CreateEventSourceMappingRequest.t
type output = EventSourceMappingConfiguration.t
type error = Errors_internal.t
let service = "lambda"
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", ["2015-03-31"]);
("Action", ["CreateEventSourceMapping"])]
(Util.drop_empty
(Uri.query_of_encoded
(Query.render (CreateEventSourceMappingRequest.to_query req))))) in
(`POST, uri, [])
let of_http body =
try
let xml = Ezxmlm.from_string body in
let resp = Xml.member "CreateEventSourceMappingResponse" (snd xml) in
try
Util.or_error
(Util.option_bind resp EventSourceMappingConfiguration.parse)
(let open Error in
BadResponse
{
body;
message =
"Could not find well formed EventSourceMappingConfiguration."
})
with
| Xml.RequiredFieldMissing msg ->
let open Error in
`Error
(BadResponse
{
body;
message =
("Error parsing EventSourceMappingConfiguration - 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/lambda/lib/createEventSourceMapping.mli
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
open Types
type input = CreateEventSourceMappingRequest.t
type output = EventSourceMappingConfiguration.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/lambda/lib/createFunction.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
open Types
open Aws
type input = CreateFunctionRequest.t
type output = FunctionConfiguration.t
type error = Errors_internal.t
let service = "lambda"
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", ["2015-03-31"]); ("Action", ["CreateFunction"])]
(Util.drop_empty
(Uri.query_of_encoded
(Query.render (CreateFunctionRequest.to_query req))))) in
(`POST, uri, [])
let of_http body =
try
let xml = Ezxmlm.from_string body in
let resp = Xml.member "CreateFunctionResponse" (snd xml) in
try
Util.or_error (Util.option_bind resp FunctionConfiguration.parse)
(let open Error in
BadResponse
{
body;
message = "Could not find well formed FunctionConfiguration."
})
with
| Xml.RequiredFieldMissing msg ->
let open Error in
`Error
(BadResponse
{
body;
message =
("Error parsing FunctionConfiguration - 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/lambda/lib/createFunction.mli
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
open Types
type input = CreateFunctionRequest.t
type output = FunctionConfiguration.t
type error = Errors_internal.t
include
Aws.Call with type input := input and type output := output and type
error := error
61 changes: 61 additions & 0 deletions libraries/lambda/lib/deleteEventSourceMapping.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
open Types
open Aws
type input = DeleteEventSourceMappingRequest.t
type output = EventSourceMappingConfiguration.t
type error = Errors_internal.t
let service = "lambda"
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", ["2015-03-31"]);
("Action", ["DeleteEventSourceMapping"])]
(Util.drop_empty
(Uri.query_of_encoded
(Query.render (DeleteEventSourceMappingRequest.to_query req))))) in
(`DELETE, uri, [])
let of_http body =
try
let xml = Ezxmlm.from_string body in
let resp = Xml.member "DeleteEventSourceMappingResponse" (snd xml) in
try
Util.or_error
(Util.option_bind resp EventSourceMappingConfiguration.parse)
(let open Error in
BadResponse
{
body;
message =
"Could not find well formed EventSourceMappingConfiguration."
})
with
| Xml.RequiredFieldMissing msg ->
let open Error in
`Error
(BadResponse
{
body;
message =
("Error parsing EventSourceMappingConfiguration - 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/lambda/lib/deleteEventSourceMapping.mli
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
open Types
type input = DeleteEventSourceMappingRequest.t
type output = EventSourceMappingConfiguration.t
type error = Errors_internal.t
include
Aws.Call with type input := input and type output := output and type
error := error
31 changes: 31 additions & 0 deletions libraries/lambda/lib/deleteFunction.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
open Types
open Aws
type input = DeleteFunctionRequest.t
type output = unit
type error = Errors_internal.t
let service = "lambda"
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", ["2015-03-31"]); ("Action", ["DeleteFunction"])]
(Util.drop_empty
(Uri.query_of_encoded
(Query.render (DeleteFunctionRequest.to_query req))))) in
(`DELETE, uri, [])
let of_http body = `Ok ()
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/lambda/lib/deleteFunction.mli
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
open Types
type input = DeleteFunctionRequest.t
type output = unit
type error = Errors_internal.t
include
Aws.Call with type input := input and type output := output and type
error := error
6 changes: 6 additions & 0 deletions libraries/lambda/lib/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
(library
(name aws_lambda)
(public_name aws-lambda)
(synopsis "aws-AWS Lambda")
(flags (:standard -w -27))
(libraries aws))
Loading