|
17 | 17 |
|
18 | 18 | package org.apache.openwhisk.core.database.s3 |
19 | 19 |
|
20 | | -import java.net.ServerSocket |
21 | | - |
| 20 | +import java.net.{ServerSocket, URI} |
22 | 21 | import actionContainers.ActionContainer |
23 | 22 | import org.apache.pekko.actor.ActorSystem |
24 | | -import com.amazonaws.auth.{AWSStaticCredentialsProvider, BasicAWSCredentials} |
25 | | -import com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration |
26 | | -import com.amazonaws.services.s3.AmazonS3ClientBuilder |
27 | 23 | import com.typesafe.config.ConfigFactory |
28 | 24 | import common.{SimpleExec, StreamLogging} |
29 | 25 | import org.scalatest.BeforeAndAfterAll |
30 | 26 | import org.scalatest.flatspec.AnyFlatSpec |
31 | 27 | import org.apache.openwhisk.common.{Logging, TransactionId} |
32 | 28 | import org.apache.openwhisk.core.database.{AttachmentStore, DocumentSerializer} |
| 29 | +import software.amazon.awssdk.auth.credentials.{AwsBasicCredentials, StaticCredentialsProvider} |
| 30 | +import software.amazon.awssdk.regions.Region |
| 31 | +import software.amazon.awssdk.services.s3.S3Client |
| 32 | +import software.amazon.awssdk.services.s3.model.CreateBucketRequest |
33 | 33 |
|
34 | 34 | import scala.concurrent.duration._ |
35 | 35 | import scala.reflect.ClassTag |
@@ -89,14 +89,16 @@ trait S3Minio extends AnyFlatSpec with BeforeAndAfterAll with StreamLogging { |
89 | 89 | } |
90 | 90 |
|
91 | 91 | def createTestBucket(): Unit = { |
92 | | - val endpoint = new EndpointConfiguration(s"http://localhost:$port", "us-west-2") |
93 | | - val client = AmazonS3ClientBuilder.standard |
94 | | - .withPathStyleAccessEnabled(true) |
95 | | - .withEndpointConfiguration(endpoint) |
96 | | - .withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials(accessKey, secretAccessKey))) |
97 | | - .build |
| 92 | + val client = S3Client |
| 93 | + .builder() |
| 94 | + .forcePathStyle(true) |
| 95 | + .endpointOverride(URI.create(s"http://localhost:$port")) |
| 96 | + .region(Region.US_WEST_2) |
| 97 | + .credentialsProvider(StaticCredentialsProvider.create(AwsBasicCredentials.create(accessKey, secretAccessKey))) |
| 98 | + .build() |
98 | 99 |
|
99 | | - org.apache.openwhisk.utils.retry(client.createBucket(bucket), 6, Some(1.minute)) |
| 100 | + org.apache.openwhisk.utils |
| 101 | + .retry(client.createBucket((b: CreateBucketRequest.Builder) => b.bucket(bucket)), 6, Some(1.minute)) |
100 | 102 | println(s"Created bucket $bucket") |
101 | 103 | } |
102 | 104 |
|
|
0 commit comments