Fork me on GitHub
#aws
<
2015-12-28
>
alandipert21:12:52

(perhaps amazonica isn't configured to generate proxy functions for the tag-related methods for some reason?)

clojuregeek21:12:30

@alandipert: i do have a method get-bucket-tagging-configuration when i do (dir amazonica.aws.s3)

clojuregeek21:12:28

I can't figure out how i need to call it though

alandipert21:12:50

i think maybe with the string name of the bucket, according to javadoc

alandipert21:12:01

another overload takes some configuration map

clojuregeek21:12:12

dev> (s3/get-bucket-tagging-configuration creds {:bucket "mybucket"})
IllegalArgumentException The bucket name must be specified when retrieving the bucket tagging configuration.  com.amazonaws.services.s3.\
AmazonS3Client.rejectNull (AmazonS3Client.java:2847)

alandipert21:12:29

try (s3/get-bucket-tagging-configuration creds "mybucket")

clojuregeek21:12:02

that gives me

IllegalArgumentException wrong number of arguments  sun.reflect.NativeMethodAccessorImpl.invoke0 (NativeMethodAccessorImpl.java:-2)

alandipert21:12:31

ok last guess

alandipert21:12:43

(s3/get-bucket-tagging-configuration creds {:bucket-name "mybucket"})

alandipert22:12:21

maybe call the java things directly?

alandipert22:12:32

i find myself doing this now most of the time, for reasons like this

alandipert22:12:56

(def emr
  (if (resolve 'boot.core/*boot-version*)
    ;; If we're in boot, we're running locally
    (let [creds (com.amazonaws.auth.BasicAWSCredentials.
                 (System/getenv "ADZERK_AWS_ACCESS_KEY")
                 (System/getenv "ADZERK_AWS_SECRET_KEY"))]
      (AmazonElasticMapReduceClient. creds))
    ;; In Lambda, credentials come from role
    (AmazonElasticMapReduceClient.)))

alandipert22:12:31

if you sub for AmazonS3Client there you'll have yourself a working client, just tweak the ADZERK_* creds for whatever you use

alandipert22:12:38

when you have a credentialed AmazonS3Client you can call getBucketTaggingConfiguration on it with the bucket name as string

clojuregeek22:12:54

ok thanks for your help, i'll see if I can access the java directly. If I can figure it out, i'll write a blog post simple_smile

alandipert22:12:52

@clojuregeek: np! here is a self-contained script that gets the tags for a bucket - https://gist.github.com/alandipert/39c65618ecc716e38210

alandipert22:12:52

no problem, see you later