use of com.amazonaws.ClientConfiguration in project camel by apache.
the class SesEndpoint method createSESClient.
private AmazonSimpleEmailService createSESClient() {
AmazonSimpleEmailService client = null;
ClientConfiguration clientConfiguration = null;
boolean isClientConfigFound = false;
if (ObjectHelper.isNotEmpty(configuration.getProxyHost()) && ObjectHelper.isNotEmpty(configuration.getProxyPort())) {
clientConfiguration = new ClientConfiguration();
clientConfiguration.setProxyHost(configuration.getProxyHost());
clientConfiguration.setProxyPort(configuration.getProxyPort());
isClientConfigFound = true;
}
if (configuration.getAccessKey() != null && configuration.getSecretKey() != null) {
AWSCredentials credentials = new BasicAWSCredentials(configuration.getAccessKey(), configuration.getSecretKey());
if (isClientConfigFound) {
client = new AmazonSimpleEmailServiceClient(credentials, clientConfiguration);
} else {
client = new AmazonSimpleEmailServiceClient(credentials);
}
} else {
if (isClientConfigFound) {
client = new AmazonSimpleEmailServiceClient();
} else {
client = new AmazonSimpleEmailServiceClient(clientConfiguration);
}
}
return client;
}
use of com.amazonaws.ClientConfiguration in project camel by apache.
the class S3Endpoint method createS3Client.
/**
* Provide the possibility to override this method for an mock implementation
*/
AmazonS3 createS3Client() {
AmazonS3Client client = null;
ClientConfiguration clientConfiguration = null;
boolean isClientConfigFound = false;
if (configuration.hasProxyConfiguration()) {
clientConfiguration = new ClientConfiguration();
clientConfiguration.setProxyHost(configuration.getProxyHost());
clientConfiguration.setProxyPort(configuration.getProxyPort());
isClientConfigFound = true;
}
if (configuration.getAccessKey() != null && configuration.getSecretKey() != null) {
AWSCredentials credentials = new BasicAWSCredentials(configuration.getAccessKey(), configuration.getSecretKey());
if (isClientConfigFound) {
client = new AmazonS3Client(credentials, clientConfiguration);
} else {
client = new AmazonS3Client(credentials);
}
} else {
if (isClientConfigFound) {
client = new AmazonS3Client();
} else {
client = new AmazonS3Client(clientConfiguration);
}
}
S3ClientOptions clientOptions = S3ClientOptions.builder().setPathStyleAccess(configuration.isPathStyleAccess()).build();
client.setS3ClientOptions(clientOptions);
return client;
}
use of com.amazonaws.ClientConfiguration in project camel by apache.
the class SWFEndpoint method createSWClient.
private AmazonSimpleWorkflowClient createSWClient() throws Exception {
AWSCredentials credentials = new BasicAWSCredentials(configuration.getAccessKey(), configuration.getSecretKey());
ClientConfiguration clientConfiguration = new ClientConfiguration();
if (!configuration.getClientConfigurationParameters().isEmpty()) {
setProperties(clientConfiguration, configuration.getClientConfigurationParameters());
}
AmazonSimpleWorkflowClient client = new AmazonSimpleWorkflowClient(credentials, clientConfiguration);
if (!configuration.getSWClientParameters().isEmpty()) {
setProperties(client, configuration.getSWClientParameters());
}
return client;
}
use of com.amazonaws.ClientConfiguration in project hadoop by apache.
the class ITestS3AConfiguration method testDefaultUserAgent.
@Test
public void testDefaultUserAgent() throws Exception {
conf = new Configuration();
fs = S3ATestUtils.createTestFileSystem(conf);
assertNotNull(fs);
AmazonS3 s3 = fs.getAmazonS3Client();
assertNotNull(s3);
ClientConfiguration awsConf = getField(s3, ClientConfiguration.class, "clientConfiguration");
assertEquals("Hadoop " + VersionInfo.getVersion(), awsConf.getUserAgentPrefix());
}
use of com.amazonaws.ClientConfiguration in project hadoop by apache.
the class ITestS3AConfiguration method testCustomUserAgent.
@Test
public void testCustomUserAgent() throws Exception {
conf = new Configuration();
conf.set(Constants.USER_AGENT_PREFIX, "MyApp");
fs = S3ATestUtils.createTestFileSystem(conf);
assertNotNull(fs);
AmazonS3 s3 = fs.getAmazonS3Client();
assertNotNull(s3);
ClientConfiguration awsConf = getField(s3, ClientConfiguration.class, "clientConfiguration");
assertEquals("MyApp, Hadoop " + VersionInfo.getVersion(), awsConf.getUserAgentPrefix());
}
Aggregations