Skip to content

Commit

Permalink
Merge branch 'add-govcloud-region-and-ap-northeast-2c-az' of https://…
Browse files Browse the repository at this point in the history
  • Loading branch information
NitriKx committed Jul 4, 2017
2 parents 7ca84c4 + f8c9852 commit 651ce48
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/java/com/netflix/ice/basic/BasicReservationService.java
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,12 @@ private void pollAPI() throws Exception {
AmazonEC2Client ec2Client = new AmazonEC2Client(AwsUtils.awsCredentialsProvider, AwsUtils.clientConfig);

for (Region region: Region.getAllRegions()) {
// GovCloud uses different credentials than standard AWS, so you would need two separate
// sets of credentials if you wanted to poll for RIs in both environments. For now, we
// just ignore GovCloud here in order to prevent AuthFailure errors.
if (region == Region.US_GOV_WEST_1) {
continue;
}
ec2Client.setEndpoint("ec2." + region.name + ".amazonaws.com");
do {
if (!StringUtils.isEmpty(token))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,12 @@ public String getSessionToken() {
ec2Client = new AmazonEC2Client(AwsUtils.awsCredentialsProvider.getCredentials(), AwsUtils.clientConfig);

for (Region region: Region.getAllRegions()) {
// GovCloud uses different credentials than standard AWS, so you would need two separate
// sets of credentials if you wanted to poll for RIs in both environments. For now, we
// just ignore GovCloud when polling for RIs in order to prevent AuthFailure errors.
if (region == Region.US_GOV_WEST_1) {
continue;
}

ec2Client.setEndpoint("ec2." + region.name + ".amazonaws.com");

Expand Down
3 changes: 3 additions & 0 deletions src/java/com/netflix/ice/tag/Region.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class Region extends Tag {
public static final Region US_EAST_2 = new Region("us-east-2", "USE2");
public static final Region US_WEST_1 = new Region("us-west-1", "USW1");
public static final Region US_WEST_2 = new Region("us-west-2", "USW2");
public static final Region US_GOV_WEST_1 = new Region("us-gov-west-1", "UGW1");
public static final Region EU_WEST_1 = new Region("eu-west-1", "EU");
public static final Region EU_WEST_2 = new Region("eu-west-2", "EUW2");
public static final Region EU_CENTRAL_1 = new Region("eu-central-1", "EUC1");
Expand All @@ -48,6 +49,7 @@ public class Region extends Tag {
regionsByShortName.put(US_EAST_2.shortName, US_EAST_2);
regionsByShortName.put(US_WEST_1.shortName, US_WEST_1);
regionsByShortName.put(US_WEST_2.shortName, US_WEST_2);
regionsByShortName.put(US_GOV_WEST_1.shortName, US_GOV_WEST_1);
regionsByShortName.put(EU_WEST_1.shortName, EU_WEST_1);
regionsByShortName.put(EU_WEST_2.shortName, EU_WEST_2);
regionsByShortName.put(EU_CENTRAL_1.shortName, EU_CENTRAL_1);
Expand All @@ -63,6 +65,7 @@ public class Region extends Tag {
regionsByName.put(US_EAST_2.name, US_EAST_2);
regionsByName.put(US_WEST_1.name, US_WEST_1);
regionsByName.put(US_WEST_2.name, US_WEST_2);
regionsByName.put(US_GOV_WEST_1.name, US_GOV_WEST_1);
regionsByName.put(EU_WEST_1.name, EU_WEST_1);
regionsByName.put(EU_WEST_2.name, EU_WEST_2);
regionsByName.put(EU_CENTRAL_1.name, EU_CENTRAL_1);
Expand Down
10 changes: 9 additions & 1 deletion src/java/com/netflix/ice/tag/Zone.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ private Zone (Region region, String name) {
public static final Zone US_WEST_2B = new Zone(Region.US_WEST_2, "us-west-2b");
public static final Zone US_WEST_2C = new Zone(Region.US_WEST_2, "us-west-2c");

public static final Zone US_GOV_WEST_1A = new Zone(Region.US_GOV_WEST_1, "us-gov-west-1a");
public static final Zone US_GOV_WEST_1B = new Zone(Region.US_GOV_WEST_1, "us-gov-west-1b");

public static final Zone EU_WEST_1A = new Zone(Region.EU_WEST_1, "eu-west-1a");
public static final Zone EU_WEST_1B = new Zone(Region.EU_WEST_1, "eu-west-1b");
public static final Zone EU_WEST_1C = new Zone(Region.EU_WEST_1, "eu-west-1c");
Expand All @@ -72,6 +75,7 @@ private Zone (Region region, String name) {

public static final Zone AP_NORTHEAST_2A = new Zone(Region.AP_NORTHEAST_2, "ap-northeast-2a");
public static final Zone AP_NORTHEAST_2B = new Zone(Region.AP_NORTHEAST_2, "ap-northeast-2b");
public static final Zone AP_NORTHEAST_2C = new Zone(Region.AP_NORTHEAST_2, "ap-northeast-2c");

public static final Zone AP_SOUTHEAST_1A = new Zone(Region.AP_SOUTHEAST_1, "ap-southeast-1a");
public static final Zone AP_SOUTHEAST_1B = new Zone(Region.AP_SOUTHEAST_1, "ap-southeast-1b");
Expand Down Expand Up @@ -108,6 +112,9 @@ private Zone (Region region, String name) {
zonesByName.put(US_WEST_2B.name, US_WEST_2B);
zonesByName.put(US_WEST_2C.name, US_WEST_2C);

zonesByName.put(US_GOV_WEST_1A.name, US_GOV_WEST_1A);
zonesByName.put(US_GOV_WEST_1B.name, US_GOV_WEST_1B);

zonesByName.put(EU_WEST_1A.name, EU_WEST_1A);
zonesByName.put(EU_WEST_1B.name, EU_WEST_1B);
zonesByName.put(EU_WEST_1C.name, EU_WEST_1C);
Expand All @@ -128,6 +135,7 @@ private Zone (Region region, String name) {

zonesByName.put(AP_NORTHEAST_2A.name, AP_NORTHEAST_2A);
zonesByName.put(AP_NORTHEAST_2B.name, AP_NORTHEAST_2B);
zonesByName.put(AP_NORTHEAST_2C.name, AP_NORTHEAST_2C);

zonesByName.put(AP_SOUTHEAST_1A.name, AP_SOUTHEAST_1A);
zonesByName.put(AP_SOUTHEAST_1B.name, AP_SOUTHEAST_1B);
Expand Down Expand Up @@ -176,4 +184,4 @@ public static List<Zone> getZones(List<String> names) {
result.add(zonesByName.get(name));
return result;
}
}
}

0 comments on commit 651ce48

Please sign in to comment.