use of software.amazon.awssdk.services.s3.S3Configuration in project syndesis by syndesisio.
the class AWSS3RawOptionsTest method createCamelContext.
@Override
protected CamelContext createCamelContext() throws Exception {
CamelContext camelContext = super.createCamelContext();
camelContext.setAutoStartup(false);
camelContext.addComponent("aws-s3", new S3Component() {
@Override
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
final S3Configuration configuration = new S3Configuration();
setProperties(configuration, parameters);
return new S3Endpoint(uri, this, configuration) {
@Override
public void doStart() throws Exception {
// don't let the endpoint to start as it would try to
// process the keys
}
};
}
});
return camelContext;
}
use of software.amazon.awssdk.services.s3.S3Configuration in project beam by apache.
the class S3FileSystemTest method beforeClass.
@BeforeClass
public static void beforeClass() {
api = new S3Mock.Builder().withInMemoryBackend().withPort(8002).build();
Http.ServerBinding binding = api.start();
URI endpoint = URI.create("http://localhost:" + binding.localAddress().getPort());
S3Configuration s3Configuration = S3Configuration.builder().pathStyleAccessEnabled(true).build();
client = S3Client.builder().region(Region.US_WEST_1).serviceConfiguration(s3Configuration).endpointOverride(endpoint).credentialsProvider(AnonymousCredentialsProvider.create()).build();
}
use of software.amazon.awssdk.services.s3.S3Configuration in project syndesis by syndesisio.
the class AWSS3VerifierExtension method verifyConnectivity.
// *********************************
// Connectivity validation
// *********************************
@Override
@SuppressWarnings("PMD.AvoidCatchingGenericException")
protected Result verifyConnectivity(Map<String, Object> parameters) {
ResultBuilder builder = ResultBuilder.withStatusAndScope(Result.Status.OK, Scope.CONNECTIVITY);
try {
S3Configuration configuration = setProperties(new S3Configuration(), parameters);
AWSCredentials credentials = new BasicAWSCredentials(configuration.getAccessKey(), configuration.getSecretKey());
AWSCredentialsProvider credentialsProvider = new AWSStaticCredentialsProvider(credentials);
AmazonS3 client = AmazonS3ClientBuilder.standard().withCredentials(credentialsProvider).withRegion(Regions.valueOf(configuration.getRegion())).build();
client.listBuckets();
} catch (SdkClientException e) {
ResultErrorBuilder errorBuilder = ResultErrorBuilder.withCodeAndDescription(VerificationError.StandardCode.AUTHENTICATION, e.getMessage()).detail("aws_s3_exception_message", e.getMessage()).detail(VerificationError.ExceptionAttribute.EXCEPTION_CLASS, e.getClass().getName()).detail(VerificationError.ExceptionAttribute.EXCEPTION_INSTANCE, e);
builder.error(errorBuilder.build());
} catch (@SuppressWarnings("PMD.AvoidCatchingGenericException") Exception e) {
builder.error(ResultErrorBuilder.withException(e).build());
}
return builder.build();
}
Aggregations