Add us-east-2 AWS region

This commit is contained in:
Alexander Kazakov 2016-12-04 20:02:05 +03:00
parent 460e787049
commit 23550f277b
4 changed files with 66 additions and 30 deletions

View File

@ -111,9 +111,10 @@ The `cloud.aws.region` can be set to a region and will automatically use the rel
The available values are:
* `us-east` (`us-east-1`) for US East (N. Virginia)
* `us-east-2` for US East (Ohio)
* `us-west` (`us-west-1`) for US West (N. California)
* `us-west-2` for US West (Oregon)
* `ap-south-1` for Asia Pacific (Mumbai)
* `ap-south` (`ap-south-1`) for Asia Pacific (Mumbai)
* `ap-southeast` (`ap-southeast-1`) for Asia Pacific (Singapore)
* `ap-southeast-2` for Asia Pacific (Sydney)
* `ap-northeast` (`ap-northeast-1`) for Asia Pacific (Tokyo)

View File

@ -116,9 +116,10 @@ You can specifically set it for s3 only using `cloud.aws.s3.region`.
The available values are:
* `us-east` (`us-east-1`) for US East (N. Virginia)
* `us-east-2` for US East (Ohio)
* `us-west` (`us-west-1`) for US West (N. California)
* `us-west-2` for US West (Oregon)
* `ap-south-1` for Asia Pacific (Mumbai)
* `ap-south` (`ap-south-1`) for Asia Pacific (Mumbai)
* `ap-southeast` (`ap-southeast-1`) for Asia Pacific (Singapore)
* `ap-southeast-2` for Asia Pacific (Sydney)
* `ap-northeast` (`ap-northeast-1`) for Asia Pacific (Tokyo)

View File

@ -141,6 +141,9 @@ public class AwsEc2ServiceImpl extends AbstractComponent implements AwsEc2Servic
case "us-east":
endpoint = "ec2.us-east-1.amazonaws.com";
break;
case "us-east-2":
endpoint = "ec2.us-east-2.amazonaws.com";
break;
case "us-west":
case "us-west-1":
endpoint = "ec2.us-west-1.amazonaws.com";
@ -152,6 +155,7 @@ public class AwsEc2ServiceImpl extends AbstractComponent implements AwsEc2Servic
case "ap-southeast-1":
endpoint = "ec2.ap-southeast-1.amazonaws.com";
break;
case "ap-south":
case "ap-south-1":
endpoint = "ec2.ap-south-1.amazonaws.com";
break;

View File

@ -162,35 +162,65 @@ public class InternalAwsS3Service extends AbstractLifecycleComponent implements
}
private static String getEndpoint(String region) {
if ("us-east".equals(region) || "us-east-1".equals(region)) {
return "s3.amazonaws.com";
} else if ("us-west".equals(region) || "us-west-1".equals(region)) {
return "s3-us-west-1.amazonaws.com";
} else if ("us-west-2".equals(region)) {
return "s3-us-west-2.amazonaws.com";
} else if (region.equals("ap-south-1")) {
return "s3-ap-south-1.amazonaws.com";
} else if ("ap-southeast".equals(region) || "ap-southeast-1".equals(region)) {
return "s3-ap-southeast-1.amazonaws.com";
} else if ("ap-southeast-2".equals(region)) {
return "s3-ap-southeast-2.amazonaws.com";
} else if ("ap-northeast".equals(region) || "ap-northeast-1".equals(region)) {
return "s3-ap-northeast-1.amazonaws.com";
} else if ("ap-northeast-2".equals(region)) {
return "s3-ap-northeast-2.amazonaws.com";
} else if ("eu-west".equals(region) || "eu-west-1".equals(region)) {
return "s3-eu-west-1.amazonaws.com";
} else if ("eu-central".equals(region) || "eu-central-1".equals(region)) {
return "s3.eu-central-1.amazonaws.com";
} else if ("sa-east".equals(region) || "sa-east-1".equals(region)) {
return "s3-sa-east-1.amazonaws.com";
} else if ("cn-north".equals(region) || "cn-north-1".equals(region)) {
return "s3.cn-north-1.amazonaws.com.cn";
} else if ("us-gov-west".equals(region) || "us-gov-west-1".equals(region)) {
return "s3-us-gov-west-1.amazonaws.com";
} else {
final String endpoint;
switch (region) {
case "us-east":
case "us-east-1":
endpoint = "s3.amazonaws.com";
break;
case "us-east-2":
endpoint = "s3.us-east-2.amazonaws.com";
break;
case "us-west":
case "us-west-1":
endpoint = "s3-us-west-1.amazonaws.com";
break;
case "us-west-2":
endpoint = "s3-us-west-2.amazonaws.com";
break;
case "ap-south":
case "ap-south-1":
endpoint = "s3-ap-south-1.amazonaws.com";
break;
case "ap-southeast":
case "ap-southeast-1":
endpoint = "s3-ap-southeast-1.amazonaws.com";
break;
case "ap-southeast-2":
endpoint = "s3-ap-southeast-2.amazonaws.com";
break;
case "ap-northeast":
case "ap-northeast-1":
endpoint = "s3-ap-northeast-1.amazonaws.com";
break;
case "ap-northeast-2":
endpoint = "s3-ap-northeast-2.amazonaws.com";
break;
case "eu-west":
case "eu-west-1":
endpoint = "s3-eu-west-1.amazonaws.com";
break;
case "eu-central":
case "eu-central-1":
endpoint = "s3.eu-central-1.amazonaws.com";
break;
case "sa-east":
case "sa-east-1":
endpoint = "s3-sa-east-1.amazonaws.com";
break;
case "cn-north":
case "cn-north-1":
endpoint = "s3.cn-north-1.amazonaws.com.cn";
break;
case "us-gov-west":
case "us-gov-west-1":
endpoint = "s3-us-gov-west-1.amazonaws.com";
break;
default:
throw new IllegalArgumentException("No automatic endpoint could be derived from region [" + region + "]");
}
return endpoint;
}
@Override