use of com.amazonaws.auth.AWSCredentials in project camel by apache.
the class SdbEndpoint method createSdbClient.
AmazonSimpleDB createSdbClient() {
AmazonSimpleDB 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 AmazonSimpleDBClient(credentials, clientConfiguration);
} else {
client = new AmazonSimpleDBClient(credentials);
}
} else {
if (isClientConfigFound) {
client = new AmazonSimpleDBClient();
} else {
client = new AmazonSimpleDBClient(clientConfiguration);
}
}
return client;
}
use of com.amazonaws.auth.AWSCredentials 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.auth.AWSCredentials 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.auth.AWSCredentials 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.auth.AWSCredentials in project elasticsearch by elastic.
the class AwsS3ServiceImplTests method launchAWSCredentialsWithElasticsearchSettingsTest.
protected void launchAWSCredentialsWithElasticsearchSettingsTest(Settings singleRepositorySettings, Settings settings, String expectedKey, String expectedSecret) {
String configName = InternalAwsS3Service.CLIENT_NAME.get(singleRepositorySettings);
AWSCredentials credentials = InternalAwsS3Service.buildCredentials(logger, deprecationLogger, settings, singleRepositorySettings, configName).getCredentials();
assertThat(credentials.getAWSAccessKeyId(), is(expectedKey));
assertThat(credentials.getAWSSecretKey(), is(expectedSecret));
}
Aggregations