use of com.amazonaws.ClientConfiguration in project flink by apache.
the class KinesisProxy method createKinesisClient.
/**
* Create the Kinesis client, using the provided configuration properties and default {@link
* ClientConfiguration}. Derived classes can override this method to customize the client
* configuration.
*/
protected AmazonKinesis createKinesisClient(Properties configProps) {
ClientConfiguration awsClientConfig = new ClientConfigurationFactory().getConfig();
AWSUtil.setAwsClientConfigProperties(awsClientConfig, configProps);
return AWSUtil.createKinesisClient(configProps, awsClientConfig);
}
use of com.amazonaws.ClientConfiguration in project beam by apache.
the class AwsModuleTest method testAwsHttpClientConfigurationSerializationDeserialization.
@Test
public void testAwsHttpClientConfigurationSerializationDeserialization() throws Exception {
ClientConfiguration clientConfiguration = new ClientConfiguration();
clientConfiguration.setConnectionTimeout(100);
clientConfiguration.setConnectionMaxIdleMillis(1000);
clientConfiguration.setSocketTimeout(300);
final String valueAsJson = objectMapper.writeValueAsString(clientConfiguration);
final ClientConfiguration clientConfigurationDeserialized = objectMapper.readValue(valueAsJson, ClientConfiguration.class);
assertEquals(100, clientConfigurationDeserialized.getConnectionTimeout());
assertEquals(1000, clientConfigurationDeserialized.getConnectionMaxIdleMillis());
assertEquals(300, clientConfigurationDeserialized.getSocketTimeout());
}
use of com.amazonaws.ClientConfiguration in project beam by apache.
the class AwsModuleTest method testClientConfigurationSerializationDeserialization.
@Test
public void testClientConfigurationSerializationDeserialization() throws Exception {
ClientConfiguration clientConfiguration = new ClientConfiguration();
clientConfiguration.setProxyHost("localhost");
clientConfiguration.setProxyPort(1234);
clientConfiguration.setProxyUsername("username");
clientConfiguration.setProxyPassword("password");
final String valueAsJson = objectMapper.writeValueAsString(clientConfiguration);
final ClientConfiguration valueDes = objectMapper.readValue(valueAsJson, ClientConfiguration.class);
assertEquals("localhost", valueDes.getProxyHost());
assertEquals(1234, valueDes.getProxyPort());
assertEquals("username", valueDes.getProxyUsername());
assertEquals("password", valueDes.getProxyPassword());
}
use of com.amazonaws.ClientConfiguration in project jackrabbit by apache.
the class Utils method getClientConfiguration.
private static ClientConfiguration getClientConfiguration(Properties prop) {
int connectionTimeOut = Integer.parseInt(prop.getProperty(S3Constants.S3_CONN_TIMEOUT));
int socketTimeOut = Integer.parseInt(prop.getProperty(S3Constants.S3_SOCK_TIMEOUT));
int maxConnections = Integer.parseInt(prop.getProperty(S3Constants.S3_MAX_CONNS));
int maxErrorRetry = Integer.parseInt(prop.getProperty(S3Constants.S3_MAX_ERR_RETRY));
String protocol = prop.getProperty(S3Constants.S3_CONN_PROTOCOL);
String proxyHost = prop.getProperty(S3Constants.PROXY_HOST);
String proxyPort = prop.getProperty(S3Constants.PROXY_PORT);
ClientConfiguration cc = new ClientConfiguration();
if (protocol != null && protocol.equalsIgnoreCase("http")) {
cc.setProtocol(Protocol.HTTP);
}
if (proxyHost != null && !proxyHost.isEmpty()) {
cc.setProxyHost(proxyHost);
}
if (proxyPort != null && !proxyPort.isEmpty()) {
cc.setProxyPort(Integer.parseInt(proxyPort));
}
cc.setConnectionTimeout(connectionTimeOut);
cc.setSocketTimeout(socketTimeOut);
cc.setMaxConnections(maxConnections);
cc.setMaxErrorRetry(maxErrorRetry);
return cc;
}
use of com.amazonaws.ClientConfiguration in project druid by druid-io.
the class S3StorageDruidModule method getServerSideEncryptingAmazonS3Builder.
// This provides ServerSideEncryptingAmazonS3.Builder with default configs from Guice injection initially set.
// However, this builder can then be modified and have configuration(s) inside
// AmazonS3ClientBuilder and/or S3StorageConfig overridden before being built.
@Provides
public ServerSideEncryptingAmazonS3.Builder getServerSideEncryptingAmazonS3Builder(AWSCredentialsProvider provider, AWSProxyConfig proxyConfig, AWSEndpointConfig endpointConfig, AWSClientConfig clientConfig, S3StorageConfig storageConfig) {
final ClientConfiguration configuration = new ClientConfigurationFactory().getConfig();
final Protocol protocol = determineProtocol(clientConfig, endpointConfig);
final AmazonS3ClientBuilder amazonS3ClientBuilder = AmazonS3Client.builder().withCredentials(provider).withClientConfiguration(setProxyConfig(configuration, proxyConfig).withProtocol(protocol)).withChunkedEncodingDisabled(clientConfig.isDisableChunkedEncoding()).withPathStyleAccessEnabled(clientConfig.isEnablePathStyleAccess()).withForceGlobalBucketAccessEnabled(clientConfig.isForceGlobalBucketAccessEnabled());
if (StringUtils.isNotEmpty(endpointConfig.getUrl())) {
amazonS3ClientBuilder.setEndpointConfiguration(new EndpointConfiguration(endpointConfig.getUrl(), endpointConfig.getSigningRegion()));
}
return ServerSideEncryptingAmazonS3.builder().setAmazonS3ClientBuilder(amazonS3ClientBuilder).setS3StorageConfig(storageConfig);
}
Aggregations