Skip to content

Commit 3646fda

Browse files
authored
Bump aws-api + s3 dependencies to their latest versions (#67)
* wip * add resources file configuration * bump dependencies
1 parent 2235d12 commit 3646fda

File tree

6 files changed

+47
-22
lines changed

6 files changed

+47
-22
lines changed

Diff for: aws-api-s3/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@ pom.xml.asc
1010
/.nrepl-port
1111
.hgignore
1212
.hg/
13+
/.idea/
14+
/aws-api-s3.iml

Diff for: aws-api-s3/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ Testing whether [cognitect/aws-api+s3](https://github.com/cognitect-labs/aws-api
66

77
Currently testing:
88

9-
[com.cognitect.aws/api "0.8.301"]
10-
[com.cognitect.aws/endpoints "1.1.11.537"]
11-
[com.cognitect.aws/s3 "714.2.430.0"]
9+
[com.cognitect.aws/api "0.8.692"]
10+
[com.cognitect.aws/endpoints "1.1.12.772"]
11+
[com.cognitect.aws/s3 "869.2.1687.0"]
1212

1313
Gotchas:
1414

Diff for: aws-api-s3/graalvm-resources/resource-config.json

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"resources": {
3+
"includes": [
4+
{
5+
"pattern": "cognitect/aws/.+\\.edn"
6+
},
7+
{
8+
"pattern" : "cognitect_aws_http.edn"
9+
}
10+
]
11+
}
12+
}

Diff for: aws-api-s3/project.clj

+18-16
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,32 @@
11
(defproject aws-api-s3 "0.1.0-SNAPSHOT"
22

3-
:dependencies [[org.clojure/clojure "1.10.2-rc1"]
4-
[com.cognitect.aws/api "0.8.484"]
5-
[com.cognitect.aws/endpoints "1.1.11.926"]
6-
[com.cognitect.aws/s3 "810.2.817.0"]]
3+
:dependencies [[org.clojure/clojure "1.12.0"]
4+
[com.cognitect.aws/api "0.8.692"]
5+
[com.cognitect.aws/endpoints "1.1.12.772"]
6+
[com.cognitect.aws/s3 "869.2.1687.0"]
7+
[com.github.clj-easy/graal-build-time "1.0.5"]]
78

89
:main simple.main
910

1011
:uberjar-name "simple-main.jar"
1112
:profiles {:uberjar {:aot :all}
12-
:dev {:plugins [[lein-shell "0.5.0"]]}}
13+
:dev {:plugins [[lein-shell "0.5.0"]]}}
1314

1415
:aliases
15-
{"native-config"
16+
{"native"
1617
["shell"
17-
;; run the application to infer the build configuration
18-
"java" "-agentlib:native-image-agent=config-output-dir=./target/config/"
19-
"-jar" "./target/${:uberjar-name:-${:name}-${:version}-standalone.jar}"]
20-
21-
"native"
22-
["shell"
23-
"native-image" "--report-unsupported-elements-at-runtime" "--no-server" "--no-fallback"
24-
"-H:+PrintClassInitialization"
25-
"-H:ConfigurationFileDirectories=./target/config/"
26-
"--initialize-at-build-time"
18+
"native-image"
19+
"--no-fallback"
20+
"--report-unsupported-elements-at-runtime"
21+
"--no-server"
2722
"--allow-incomplete-classpath"
23+
"--initialize-at-build-time"
24+
"-H:+PrintClassInitialization"
25+
"--features=clj_easy.graal_build_time.InitClojureClasses"
26+
27+
"-H:+UnlockExperimentalVMOptions"
28+
"-H:ConfigurationFileDirectories=graalvm-resources"
29+
2830
"--enable-http" "--enable-https" "--enable-all-security-services"
2931
"-jar" "./target/${:uberjar-name:-${:name}-${:version}-standalone.jar}"
3032
"-H:Name=./target/${:name}"]

Diff for: aws-api-s3/resources/config.edn

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{:access-key-id "RANDOM-ACCESS-KEY-ID"
2+
:secret-access-key "random/secret/access-key"}

Diff for: aws-api-s3/src/simple/main.clj

+10-3
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
11
(ns simple.main
2-
(:require [cognitect.aws.client.api :as aws]
2+
(:require [clojure.edn :as edn]
3+
[cognitect.aws.client.api :as aws]
4+
[cognitect.aws.credentials :as credentials]
35
;; add this for graalvm (explicit load)
46
;; there are dynamically loaded at runtime
57
[cognitect.aws.http.cognitect]
68
[cognitect.aws.protocols.json]
7-
[cognitect.aws.protocols.common]
89
[cognitect.aws.protocols.rest]
910
[cognitect.aws.protocols.rest-xml]
1011
[clojure.spec.alpha])
1112
(:gen-class))
1213

14+
(defn fetch-config []
15+
(edn/read-string (slurp "resources/config.edn")))
16+
1317

1418
(defn -main []
1519
;; create a http-client and pass it while create aws clients to avoid dynamic loading
1620
;; use a `delay` if you want to share the http-client across many aws-clients
17-
(let [s3 (aws/client {:api :s3 :http-client (cognitect.aws.http.cognitect/create)})]
21+
(let [config (fetch-config)
22+
s3 (aws/client {:api :s3
23+
:http-client (cognitect.aws.http.cognitect/create)
24+
:credentials-provider (credentials/basic-credentials-provider config)})]
1825
(prn (aws/invoke s3 {:op :ListBuckets}))))

0 commit comments

Comments
 (0)