use of com.amazonaws.ClientConfiguration in project eureka by Netflix.
the class AwsAsgUtil method getAmazonAutoScalingClient.
private AmazonAutoScaling getAmazonAutoScalingClient() {
String aWSAccessId = serverConfig.getAWSAccessId();
String aWSSecretKey = serverConfig.getAWSSecretKey();
ClientConfiguration clientConfiguration = new ClientConfiguration().withConnectionTimeout(serverConfig.getASGQueryTimeoutMs());
if (null != aWSAccessId && !"".equals(aWSAccessId) && null != aWSSecretKey && !"".equals(aWSSecretKey)) {
return new AmazonAutoScalingClient(new BasicAWSCredentials(aWSAccessId, aWSSecretKey), clientConfiguration);
} else {
return new AmazonAutoScalingClient(new InstanceProfileCredentialsProvider(), clientConfiguration);
}
}
use of com.amazonaws.ClientConfiguration in project simplejpa by appoxy.
the class EntityManagerFactoryImpl method createConfiguration.
private ClientConfiguration createConfiguration(boolean isSecure) {
ClientConfiguration config = new ClientConfiguration();
config.setUserAgent(USER_AGENT);
Protocol protocol = isSecure ? Protocol.HTTPS : Protocol.HTTP;
config.setProtocol(protocol);
return config;
}
use of com.amazonaws.ClientConfiguration in project flink by apache.
the class KinesisProxyTest method testClientConfigOverride.
@Test
public void testClientConfigOverride() {
Properties configProps = new Properties();
configProps.setProperty(AWSConfigConstants.AWS_REGION, "us-east-1");
configProps.setProperty(AWSUtil.AWS_CLIENT_CONFIG_PREFIX + "socketTimeout", "9999");
KinesisProxyInterface proxy = KinesisProxy.create(configProps);
AmazonKinesis kinesisClient = Whitebox.getInternalState(proxy, "kinesisClient");
ClientConfiguration clientConfiguration = Whitebox.getInternalState(kinesisClient, "clientConfiguration");
assertEquals(9999, clientConfiguration.getSocketTimeout());
}
use of com.amazonaws.ClientConfiguration in project flink by apache.
the class KinesisProxyTest method testCustomConfigurationOverride.
@Test
public void testCustomConfigurationOverride() {
Properties configProps = new Properties();
configProps.setProperty(AWSConfigConstants.AWS_REGION, "us-east-1");
KinesisProxy proxy = new KinesisProxy(configProps) {
@Override
protected AmazonKinesis createKinesisClient(Properties configProps) {
ClientConfiguration clientConfig = new ClientConfigurationFactory().getConfig();
clientConfig.setSocketTimeout(10000);
return AWSUtil.createKinesisClient(configProps, clientConfig);
}
};
AmazonKinesis kinesisClient = Whitebox.getInternalState(proxy, "kinesisClient");
ClientConfiguration clientConfiguration = Whitebox.getInternalState(kinesisClient, "clientConfiguration");
assertEquals(10000, clientConfiguration.getSocketTimeout());
}
use of com.amazonaws.ClientConfiguration in project flink by apache.
the class DynamoDBStreamsProxy method createKinesisClient.
/**
* Creates an AmazonDynamoDBStreamsAdapterClient. Uses it as the internal client interacting
* with the DynamoDB streams.
*
* @param configProps configuration properties
* @return an AWS DynamoDB streams adapter client
*/
@Override
protected AmazonKinesis createKinesisClient(Properties configProps) {
ClientConfiguration awsClientConfig = new ClientConfigurationFactory().getConfig();
setAwsClientConfigProperties(awsClientConfig, configProps);
AWSCredentialsProvider credentials = getCredentialsProvider(configProps);
awsClientConfig.setUserAgentPrefix(String.format(USER_AGENT_FORMAT, EnvironmentInformation.getVersion(), EnvironmentInformation.getRevisionInformation().commitId));
AmazonDynamoDBStreamsAdapterClient adapterClient = new AmazonDynamoDBStreamsAdapterClient(credentials, awsClientConfig);
if (configProps.containsKey(AWS_ENDPOINT)) {
adapterClient.setEndpoint(configProps.getProperty(AWS_ENDPOINT));
} else {
adapterClient.setRegion(Region.getRegion(Regions.fromName(configProps.getProperty(AWS_REGION))));
}
return adapterClient;
}
Aggregations