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:
parent
2b9bdc3796
commit
8eb6e91eac
|
@ -68,6 +68,18 @@ public class AwsEc2Service extends AbstractLifecycleComponent<AwsEc2Service> {
|
||||||
throw new ElasticSearchIllegalArgumentException("No s3 secret_key defined for s3 gateway");
|
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);
|
this.client = new AmazonEC2Client(new BasicAWSCredentials(account, key), clientConfiguration);
|
||||||
|
|
||||||
if (componentSettings.get("ec2.endpoint") != null) {
|
if (componentSettings.get("ec2.endpoint") != null) {
|
||||||
|
|
|
@ -68,6 +68,18 @@ public class AwsS3Service extends AbstractLifecycleComponent<AwsS3Service> {
|
||||||
throw new ElasticSearchIllegalArgumentException("No s3 secret_key defined for s3 gateway");
|
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);
|
this.client = new AmazonS3Client(new BasicAWSCredentials(account, key), clientConfiguration);
|
||||||
|
|
||||||
if (componentSettings.get("s3.endpoint") != null) {
|
if (componentSettings.get("s3.endpoint") != null) {
|
||||||
|
|
Loading…
Reference in New Issue