Skip to content
Snippets Groups Projects
Commit dd6b0a26 authored by Sebastian Rieger's avatar Sebastian Rieger
Browse files

used amazon s3 client builder

parent 13ee18f0
No related branches found
No related tags found
No related merge requests found
......@@ -4,7 +4,6 @@ package verteiltesysteme.aws;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import com.amazonaws.regions.Regions;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3ClientBuilder;
......@@ -17,15 +16,13 @@ public class TCPTimeCounterRESTService {
private Long getCounter() {
// Verbindung zu S3
AmazonS3 s3Client = AmazonS3ClientBuilder.defaultClient();
s3Client.setRegion(com.amazonaws.regions.Region.getRegion(Regions.EU_CENTRAL_1));
AmazonS3 s3Client = AmazonS3ClientBuilder.standard().withRegion(bucketRegion).build();
return new Long(s3Client.getObjectAsString(bucketName, bucketRegion));
}
private boolean setCounter(Long counter) {
// Verbindung zu S3
AmazonS3 s3Client = AmazonS3ClientBuilder.defaultClient();
s3Client.setRegion(com.amazonaws.regions.Region.getRegion(Regions.EU_CENTRAL_1));
AmazonS3 s3Client = AmazonS3ClientBuilder.standard().withRegion(bucketRegion).build();
s3Client.putObject(bucketName, bucketRegion, new Long(counter).toString());
return true;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment