AWS Plugin: Add more automatic region configuration, closes #1490.

This commit is contained in:
Shay Banon 2011-11-23 18:09:27 +02:00
parent b2e329a609
commit e8d91a66b6
2 changed files with 14 additions and 2 deletions

View File

@ -103,10 +103,16 @@ public class AwsEc2Service extends AbstractLifecycleComponent<AwsEc2Service> {
endpoint = "ec2.us-west-1.amazonaws.com"; endpoint = "ec2.us-west-1.amazonaws.com";
} else if ("us-west-1".equals(region.toLowerCase())) { } else if ("us-west-1".equals(region.toLowerCase())) {
endpoint = "ec2.us-west-1.amazonaws.com"; endpoint = "ec2.us-west-1.amazonaws.com";
} else if ("us-west-2".equals(region.toLowerCase())) {
endpoint = "ec2.us-west-2.amazonaws.com";
} else if ("ap-southeast".equals(region.toLowerCase())) { } else if ("ap-southeast".equals(region.toLowerCase())) {
endpoint = "ec2.ap-southeast-1.amazonaws.com"; endpoint = "ec2.ap-southeast-1.amazonaws.com";
} else if ("ap-southeast-1".equals(region.toLowerCase())) { } else if ("ap-southeast-1".equals(region.toLowerCase())) {
endpoint = "ec2.ap-southeast-1.amazonaws.com"; endpoint = "ec2.ap-southeast-1.amazonaws.com";
} else if ("ap-northeast".equals(region.toLowerCase())) {
endpoint = "ec2.ap-northeast.amazonaws.com\t";
} else if ("ap-northeast-1".equals(region.toLowerCase())) {
endpoint = "ec2.ap-northeast-1.amazonaws.com\t";
} else if ("eu-west".equals(region.toLowerCase())) { } else if ("eu-west".equals(region.toLowerCase())) {
endpoint = "ec2.eu-west-1.amazonaws.com"; endpoint = "ec2.eu-west-1.amazonaws.com";
} else if ("eu-west-1".equals(region.toLowerCase())) { } else if ("eu-west-1".equals(region.toLowerCase())) {

View File

@ -95,14 +95,20 @@ public class AwsS3Service extends AbstractLifecycleComponent<AwsS3Service> {
endpoint = "s3-us-west-1.amazonaws.com"; endpoint = "s3-us-west-1.amazonaws.com";
} else if ("us-west-1".equals(region.toLowerCase())) { } else if ("us-west-1".equals(region.toLowerCase())) {
endpoint = "s3-us-west-1.amazonaws.com"; endpoint = "s3-us-west-1.amazonaws.com";
} else if ("us-west-2".equals(region.toLowerCase())) {
endpoint = "s3-us-west-2.amazonaws.com";
} else if ("ap-southeast".equals(region.toLowerCase())) { } else if ("ap-southeast".equals(region.toLowerCase())) {
endpoint = "s3-ap-southeast-1.amazonaws.com"; endpoint = "s3-ap-southeast-1.amazonaws.com";
} else if ("ap-southeast-1".equals(region.toLowerCase())) { } else if ("ap-southeast-1".equals(region.toLowerCase())) {
endpoint = "s3-ap-southeast-1.amazonaws.com"; endpoint = "s3-ap-southeast-1.amazonaws.com";
} else if ("ap-northeast".equals(region.toLowerCase())) {
endpoint = "s3-ap-northeast-1.amazonaws.com";
} else if ("ap-northeast-1".equals(region.toLowerCase())) {
endpoint = "s3-ap-northeast-1.amazonaws.com";
} else if ("eu-west".equals(region.toLowerCase())) { } else if ("eu-west".equals(region.toLowerCase())) {
endpoint = null; // no specific endpoint for EU (still can be used for region) endpoint = "s3-eu-west-1.amazonaws.com";
} else if ("eu-west-1".equals(region.toLowerCase())) { } else if ("eu-west-1".equals(region.toLowerCase())) {
endpoint = null; // no specific endpoint for EU (still can be used for region) endpoint = "s3-eu-west-1.amazonaws.com";
} else { } else {
throw new ElasticSearchIllegalArgumentException("No automatic endpoint could be derived from region [" + region + "]"); throw new ElasticSearchIllegalArgumentException("No automatic endpoint could be derived from region [" + region + "]");
} }