Skip to content

Commit

Permalink
Allowing for region, endpoint and clientOptions to be set as a part o…
Browse files Browse the repository at this point in the history
…f the AmazonS3ScalaClient constructor
  • Loading branch information
Eric Meisel committed May 20, 2017
1 parent 26c1bae commit 2dae5f3
Show file tree
Hide file tree
Showing 2 changed files with 507 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ package com.github.dwhjames.awswrap
package s3

import com.amazonaws.auth.BasicAWSCredentials
import com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration
import com.amazonaws.regions.Regions
import com.amazonaws.services.s3._
import com.amazonaws.services.s3.transfer._
import org.scalatest.{BeforeAndAfterAll, Suite}
Expand All @@ -31,11 +33,10 @@ trait S3ClientHelper
private val logger: Logger = LoggerFactory.getLogger(self.getClass)

val client = {
val option = S3ClientOptions.builder().setPathStyleAccess(true).disableChunkedEncoding().build()
val c = new AmazonS3ScalaClient(new BasicAWSCredentials("FAKE_ACCESS_KEY", "FAKE_SECRET_KEY"))
c.client.setEndpoint("http://localhost:4000")
c.client.setS3ClientOptions(option)
c
val region = Regions.DEFAULT_REGION
val clientOptions = S3ClientOptions.builder().setPathStyleAccess(true).disableChunkedEncoding().build()
val endpointConfiguration = new EndpointConfiguration("http://localhost:4000", region.getName)
new AmazonS3ScalaClient(new BasicAWSCredentials("FAKE_ACCESS_KEY", "FAKE_SECRET_KEY"), region, endpointConfiguration, clientOptions)
}

val transferManager = TransferManagerBuilder.standard().withS3Client(client.client).build()
Expand Down
Loading

0 comments on commit 2dae5f3

Please sign in to comment.