Adding support for accessing EC2 and S3 over an http proxy. This is configured using the network.proxyHost and network.proxyPort settings.

This commit is contained in:
Adam Creeger 2011-05-02 18:11:42 -07:00 committed by kimchy
parent 2b9bdc3796
commit 8eb6e91eac
2 changed files with 24 additions and 0 deletions

View File

@ -68,6 +68,18 @@ public class AwsEc2Service extends AbstractLifecycleComponent<AwsEc2Service> {
throw new ElasticSearchIllegalArgumentException("No s3 secret_key defined for s3 gateway");
}
String proxyHost = settings.get("network.proxyHost");
if (proxyHost != null) {
String portString = settings.get("network.proxyPort","80");
Integer proxyPort;
try {
proxyPort = Integer.parseInt(portString,10);
} catch (NumberFormatException ex) {
throw new ElasticSearchIllegalArgumentException("The configured proxy port value [" + portString + "] is invalid",ex);
}
clientConfiguration.withProxyHost(proxyHost).setProxyPort(proxyPort);
}
this.client = new AmazonEC2Client(new BasicAWSCredentials(account, key), clientConfiguration);
if (componentSettings.get("ec2.endpoint") != null) {

View File

@ -68,6 +68,18 @@ public class AwsS3Service extends AbstractLifecycleComponent<AwsS3Service> {
throw new ElasticSearchIllegalArgumentException("No s3 secret_key defined for s3 gateway");
}
String proxyHost = settings.get("network.proxyHost");
if (proxyHost != null) {
String portString = settings.get("network.proxyPort","80");
Integer proxyPort;
try {
proxyPort = Integer.parseInt(portString,10);
} catch (NumberFormatException ex) {
throw new ElasticSearchIllegalArgumentException("The configured proxy port value [" + portString + "] is invalid",ex);
}
clientConfiguration.withProxyHost(proxyHost).setProxyPort(proxyPort);
}
this.client = new AmazonS3Client(new BasicAWSCredentials(account, key), clientConfiguration);
if (componentSettings.get("s3.endpoint") != null) {