Search in sources :

Example 61 with AmazonS3Client

use of com.talend.shaded.com.amazonaws.services.s3.AmazonS3Client in project exhibitor by soabase.

the class S3ClientImpl method completeMultipartUpload.

@Override
public void completeMultipartUpload(CompleteMultipartUploadRequest request) throws Exception {
    RefCountedClient holder = client.get();
    AmazonS3Client amazonS3Client = holder.useClient();
    try {
        amazonS3Client.completeMultipartUpload(request);
    } finally {
        holder.release();
    }
}
Also used : AmazonS3Client(com.amazonaws.services.s3.AmazonS3Client)

Example 62 with AmazonS3Client

use of com.talend.shaded.com.amazonaws.services.s3.AmazonS3Client in project exhibitor by soabase.

the class S3ClientImpl method abortMultipartUpload.

@Override
public void abortMultipartUpload(AbortMultipartUploadRequest request) throws Exception {
    RefCountedClient holder = client.get();
    AmazonS3Client amazonS3Client = holder.useClient();
    try {
        amazonS3Client.abortMultipartUpload(request);
    } finally {
        holder.release();
    }
}
Also used : AmazonS3Client(com.amazonaws.services.s3.AmazonS3Client)

Example 63 with AmazonS3Client

use of com.talend.shaded.com.amazonaws.services.s3.AmazonS3Client in project exhibitor by soabase.

the class S3ClientImpl method getObject.

@Override
public S3Object getObject(String bucket, String key) throws Exception {
    RefCountedClient holder = client.get();
    AmazonS3Client amazonS3Client = holder.useClient();
    try {
        return amazonS3Client.getObject(bucket, key);
    } finally {
        holder.release();
    }
}
Also used : AmazonS3Client(com.amazonaws.services.s3.AmazonS3Client)

Example 64 with AmazonS3Client

use of com.talend.shaded.com.amazonaws.services.s3.AmazonS3Client in project exhibitor by soabase.

the class S3ClientImpl method createClient.

private AmazonS3Client createClient(AWSCredentialsProvider awsCredentialProvider, BasicAWSCredentials basicAWSCredentials, S3ClientConfig clientConfig) {
    AmazonS3Client localClient;
    if (awsCredentialProvider != null) {
        if (clientConfig != null) {
            localClient = new AmazonS3Client(awsCredentialProvider, clientConfig.getAWSClientConfig());
        } else {
            localClient = new AmazonS3Client(awsCredentialProvider);
        }
    } else if (basicAWSCredentials != null) {
        if (clientConfig != null) {
            localClient = new AmazonS3Client(basicAWSCredentials, clientConfig.getAWSClientConfig());
        } else {
            localClient = new AmazonS3Client(basicAWSCredentials);
        }
    } else {
        if (clientConfig != null) {
            localClient = new AmazonS3Client(clientConfig.getAWSClientConfig());
        } else {
            localClient = new AmazonS3Client();
        }
    }
    if (s3Region != null) {
        String fixedRegion = s3Region.equals("us-east-1") ? "" : ("-" + s3Region);
        String endpoint = ENDPOINT_SPEC.replace("$REGION$", fixedRegion);
        localClient.setEndpoint(endpoint);
        log.info("Setting S3 endpoint to: " + endpoint);
    }
    return localClient;
}
Also used : AmazonS3Client(com.amazonaws.services.s3.AmazonS3Client)

Example 65 with AmazonS3Client

use of com.talend.shaded.com.amazonaws.services.s3.AmazonS3Client in project exhibitor by soabase.

the class S3ClientImpl method putObject.

@Override
public PutObjectResult putObject(PutObjectRequest request) throws Exception {
    RefCountedClient holder = client.get();
    AmazonS3Client amazonS3Client = holder.useClient();
    try {
        return amazonS3Client.putObject(request);
    } finally {
        holder.release();
    }
}
Also used : AmazonS3Client(com.amazonaws.services.s3.AmazonS3Client)

Aggregations

AmazonS3Client (com.amazonaws.services.s3.AmazonS3Client)107 Test (org.junit.Test)23 BasicAWSCredentials (com.amazonaws.auth.BasicAWSCredentials)20 AmazonClientException (com.amazonaws.AmazonClientException)16 ClientConfiguration (com.amazonaws.ClientConfiguration)15 ArrayList (java.util.ArrayList)13 HashMap (java.util.HashMap)13 AmazonS3 (com.amazonaws.services.s3.AmazonS3)12 File (java.io.File)12 InvocationOnMock (org.mockito.invocation.InvocationOnMock)12 PutObjectResult (com.amazonaws.services.s3.model.PutObjectResult)11 UploadPartRequest (com.amazonaws.services.s3.model.UploadPartRequest)11 AWSCredentials (com.amazonaws.auth.AWSCredentials)10 AWSCredentialsProvider (com.amazonaws.auth.AWSCredentialsProvider)10 ObjectMetadata (com.amazonaws.services.s3.model.ObjectMetadata)10 AmazonServiceException (com.amazonaws.AmazonServiceException)9 AmazonS3Exception (com.amazonaws.services.s3.model.AmazonS3Exception)9 InternalEvent (com.nextdoor.bender.InternalEvent)9 TestContext (com.nextdoor.bender.aws.TestContext)9 IOException (java.io.IOException)9