Skip to content

Commit

Permalink
#54 aws version up
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Sep 5, 2017
1 parent 59356ce commit 32fd4b5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ OF THE POSSIBILITY OF SUCH DAMAGE.
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-core</artifactId>
<version>1.10.66</version>
<version>1.11.188</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-s3</artifactId>
<version>1.10.66</version>
<version>1.11.188</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/com/jcabi/s3/AwsOcket.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import com.amazonaws.services.s3.model.ObjectMetadata;
import com.amazonaws.services.s3.model.S3Object;
import com.amazonaws.services.s3.transfer.TransferManager;
import com.amazonaws.services.s3.transfer.TransferManagerBuilder;
import com.amazonaws.services.s3.transfer.Upload;
import com.amazonaws.services.s3.transfer.model.UploadResult;
import com.jcabi.aspects.Immutable;
Expand Down Expand Up @@ -210,7 +211,8 @@ public void write(final InputStream input, final ObjectMetadata meta)
try {
final AmazonS3 aws = this.bkt.region().aws();
final long start = System.currentTimeMillis();
final TransferManager tmgr = new TransferManager(aws);
final TransferManager tmgr = TransferManagerBuilder.standard()
.withS3Client(aws).build();
final Upload upload = tmgr.upload(
this.bkt.name(), this.name, cnt, meta
);
Expand Down
11 changes: 7 additions & 4 deletions src/main/java/com/jcabi/s3/Region.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@
*/
package com.jcabi.s3;

import com.amazonaws.auth.AWSStaticCredentialsProvider;
import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3Client;
import com.amazonaws.services.s3.AmazonS3ClientBuilder;
import com.jcabi.aspects.Immutable;
import com.jcabi.aspects.Loggable;
import lombok.EqualsAndHashCode;
Expand Down Expand Up @@ -98,9 +99,11 @@ public Bucket bucket(final String name) {
}
@Override
public AmazonS3 aws() {
return new AmazonS3Client(
new BasicAWSCredentials(this.key, this.secret)
);
return AmazonS3ClientBuilder.standard().withCredentials(
new AWSStaticCredentialsProvider(
new BasicAWSCredentials(this.key, this.secret)
)
).build();
}
}
}

0 comments on commit 32fd4b5

Please sign in to comment.