scala-s3

aws s3 client in scala

git clone https://9o.is/git/scala-s3.git

README.md

(1672B)


      1 Amazon S3 module
      2 =============
      3 
      4 The `aws-s3` module provides basic support for interacting with Amazon's
      5 S3 service by providing additional handlers which sign the HTTP
      6 request in accordance with the [S3 authentication specifications][1].
      7 It's possible both to sign requests for Authorization Header 
      8 Authentication and to generate signed request URIs that can be handed
      9 out to third parties for Query String Authentication.
     10 The module also provides a convenience class for interacting with S3
     11 Buckets. 
     12 
     13 ## Usage ##
     14 To use the `aws-s3` module, you will need to first sign up for the S3
     15 service.  Afterwards, Amazon should provide you with an AWS Access Key
     16 and an AWS Secret Access Key.  You will need both of these to be able
     17 to use the module.
     18 
     19 Below is an example of retrieving a file from S3:
     20 
     21     import dispatch._
     22     import inc.pyc.aws.s3._
     23     
     24     val bucketName = "bucket-name"
     25     val access_key = "XXXXXXXXX"
     26     val secret_key = "XXXXXXXXX"
     27     
     28     val s3 = S3(access_key, secret_key, bucketName, "path/in/bucket")
     29     
     30     s3.createFile(testFile.getName, testFile, "text/plain")() map {
     31       response =>
     32         // Handle response here
     33     }
     34 
     35 ## Testing
     36 
     37 To test the module, you'll need to set 3 system properties:
     38 
     39 * awsBucket
     40 * awsAccessKey
     41 * awsSecretAccessKey
     42 
     43 When using sbt 0.11, you can do the following:
     44 
     45     eval System.setProperty("awsBucket", "bucket-name")
     46     eval System.setProperty("awsAccessKey", "XXXXXXXXX")
     47     eval System.setProperty("awsSecretAccessKey", "XXXXXXXXX")
     48 
     49 After that, you can just run `test` and all of the tests should pass.
     50 
     51 [1]: http://docs.amazonwebservices.com/AmazonS3/latest/dev/index.html?RESTAuthentication.html