[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#53765] [PATCH 13/17] gnu: Add clojure-com-cognitect-aws-api.
From: |
Reily Siegel |
Subject: |
[bug#53765] [PATCH 13/17] gnu: Add clojure-com-cognitect-aws-api. |
Date: |
Mon, 07 Feb 2022 14:31:35 -0500 |
Maxime Devos <maximedevos@telenet.be> writes:
> OK, though I don't see how it can be declarative -- it's a library
> for ‘invoking AWS APIs’, which seems rather imperative, at least
> procedural.
Let me compare this library and the official Java AWS SDK.
#+BEGIN_SRC java
// Create a GetItemRequest instance
GetItemRequest request = GetItemRequest.builder()
.key(keyToGet)
.tableName(tableName)
.build();
// Invoke the DynamoDbAsyncClient object's getItem
java.util.Collection<AttributeValue> returnedItem = client.getItem(request)
.join()
.item()
.values();
#+END_SRC
#+BEGIN_SRC clojure
(aws/invoke s3 {:op :GetObject :request {:Bucket bucket-name :Key "hello.txt"}})
#+END_SRC
The Java API programatically creates a Request object, when is then
modified by several methods to set the options, before being invoked.
The Clojure API, on the other hand, specifies the operation
declaratively using plain Clojure data structures (in this case,
keywords, strings, and maps), before calling invoke on that
specification. The declarative part is in how the API is interacted
with, not necessarily what happens in the library internals or over the
wire.
Examples from the respective documentations of each project.
--
Reily Siegel
[bug#53765] [PATCH 16/17] gnu: clojure-tools-deps-alpha: Fix issues with S3, Reily Siegel, 2022/02/03
[bug#53765] [PATCH 14/17] gnu: Add clojure-com-cognitect-aws-endpoints., Reily Siegel, 2022/02/03