· 7 years ago · May 03, 2018, 05:42 PM
1(ns amazonica-s3.core
2 (:require [amazonica.aws.s3 :as s3]
3 [amazonica.aws.s3transfer :as s3t])
4 (:gen-class))
5
6(defonce cred {:access-key ""
7 :secret-key ""
8 :endpoint ""})
9(defonce bucket "")
10(defonce static-root "")
11
12(defn create-bucket [nm]
13 (s3/create-bucket cred nm))
14
15(defn put-object [path]
16 (let [content (clojure.java.io/file (str static-root path))]
17 (if-not (.exists content)
18 (println path "does not exist")
19 (s3/put-object cred
20 :bucket-name bucket
21 :key path
22 :file content))))
23
24(defn get-object [k]
25 (s3/get-object cred
26 :bucket-name bucket
27 :key k))