This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-09-08
Channels
- # aws (21)
- # beginners (62)
- # boot (29)
- # chestnut (1)
- # cider (110)
- # cljs-dev (37)
- # clojure (93)
- # clojure-berlin (1)
- # clojure-dev (10)
- # clojure-greece (4)
- # clojure-italy (5)
- # clojure-new-zealand (1)
- # clojure-spec (6)
- # clojure-uk (46)
- # clojurebridge (1)
- # clojurescript (54)
- # cryogen (1)
- # cursive (22)
- # datomic (72)
- # emacs (2)
- # events (3)
- # flambo (1)
- # hoplon (88)
- # jobs (6)
- # juxt (51)
- # lein-figwheel (1)
- # leiningen (3)
- # lumo (12)
- # mount (4)
- # off-topic (3)
- # onyx (3)
- # pedestal (4)
- # portkey (27)
- # re-frame (13)
- # reagent (1)
- # ring (4)
- # rum (2)
- # uncomplicate (1)
- # unrepl (3)
=> (binding [*credentials* {:access-key "XXXX"
:secret-key "YYYY"}
*region* "eu-central-1"]
(lambda/list-functions {}))
[:result {:functions [{:role "arn:aws:iam::238568392557:role/portkey", :description "", :code-size 5826344, :function-arn "arn:aws:lambda:eu-central-1:238568392557:function:user_Iflatter", :dead-letter-config {}, :master-arn nil, :last-modified "2017-07-13T10:08:40.196+0000", :code-sha256 "Nx3nojHfJakr8w5EVS6ZhbGq+vQ6uq0z0BRGBPpcFPg=", :runtime :java8, :memory-size 1536, :vpc-config {}, :environment {}, :tracing-config {:mode :pass-through}, :timeout 30, :version "$LATEST", :kmskey-arn nil, :handler "portkey.LambdaStub", :function-name "user_Iflatter"}], :next-marker nil}]
:kmskey-arn nil
actually brings to my mind that I did’t specify that on function creation/configuration update
Ok. Now, unless explicitly dynamically bound, credentials and region are fetched from the same usual locations (env vars, properties, profile files).
Now it’s just:
=> (require '[portkey.aws.lambda :as lambda])
=> (lambda/list-functions {})
{:functions [{:role "arn:aws:iam::238568392557:role/portkey", :description "", :code-size 5826344, :function-arn "arn:aws:lambda:eu-central-1:238568392557:function:user_Iflatter", :dead-letter-config {}, :master-arn nil, :last-modified "2017-07-13T10:08:40.196+0000", :code-sha256 "Nx3nojHfJakr8w5EVS6ZhbGq+vQ6uq0z0BRGBPpcFPg=", :runtime :java8, :memory-size 1536, :vpc-config {}, :environment {}, :tracing-config {:mode :pass-through}, :timeout 30, :version "$LATEST", :kmskey-arn nil, :handler "portkey.LambdaStub", :function-name "user_Iflatter"}], :next-marker nil}
aws-clj-sdk
can now be tested for the following services (rest-json protocol)
“AWS Batch” “AWS Greengrass” “AWS IoT” “AWS IoT Data Plane”
“AWS Lambda” “AWS X-Ray” “Amazon API Gateway”
“Amazon CloudDirectory” “Amazon CloudSearch Domain”
“Amazon Cognito Sync” “Amazon Elastic File System”
“Amazon Elastic Transcoder” “Amazon Elasticsearch Service”
“Amazon Glacier” “Amazon Lex Model Building Service”
“Amazon Lex Runtime Service” “Amazon Pinpoint” “Amazon Polly”
“Amazon WorkDocs
See example above for a simple invocation.
doc
doesn’t return a docstring at the moment but at least displays specs:
=> (doc lambda/list-functions)
-------------------------
portkey.aws.lambda/list-functions
([input__8278__auto__])
Spec
args: (tuple :portkey.aws.lambda/list-functions-request)
ret: (and :portkey.aws.lambda/list-functions-response)
the elusive s3v4 signature is v4 + special rules for payalod hashing (unsigned, chunked, normal) and the additional payload hash header
@richiardiandrea abstracting over json and http client libs.
There is provision for async support in the current design. By binding http-client one can have functions returning promises or chans instead of values.
=> (binding [aws/*http-client* aws/async-http-client]
(lambda/list-functions))
#object[clojure.core.async.impl.channels.ManyToManyChannel 0x7975d4aa "clojure.core.async.impl.channels.ManyToManyChannel@7975d4aa"]
=> (async/<!! *1)
[:result {:functions [{:role "arn:aws:iam::238568392557:role/portkey", :description "", :code-size 5826344, :function-arn "arn:aws:lambda:eu-central-1:238568392557:function:user_Iflatter", :dead-letter-config {}, :master-arn nil, :last-modified "2017-07-13T10:08:40.196+0000", :code-sha256 "Nx3nojHfJakr8w5EVS6ZhbGq+vQ6uq0z0BRGBPpcFPg=", :runtime :java8, :memory-size 1536, :vpc-config {}, :environment {}, :tracing-config {:mode :pass-through}, :timeout 30, :version "$LATEST", :kmskey-arn nil, :handler "portkey.LambdaStub", :function-name "user_Iflatter"}], :next-marker nil}]
Very nice, would be super interested in a lumo port given I am using the JS aws SDK quite extensively. So if it's only an abstraction over http, it should be quite easy to achieve that
@richiardiandrea I have good hopes that all generated files could be pure cljc
.
@cgrand will explore, thanks everything looks good