in src/main/java/com/amazon/jenkins/ec2fleet/EC2FleetCloud.java [722:746]
public ListBoxModel doFillRegionItems(@QueryParameter final String awsCredentialsId) {
// to keep user consistent order tree set
final Set<String> regionNames = new TreeSet<>();
try {
final AmazonEC2 client = Registry.getEc2Api().connect(awsCredentialsId, null, null);
final DescribeRegionsResult regions = client.describeRegions();
for (final Region region : regions.getRegions()) {
regionNames.add(region.getRegionName());
}
} catch (final Exception ex) {
// ignore exception it could be case that credentials are not belong to default region
// which we are using to describe regions
}
for (final com.amazonaws.regions.Region region : RegionUtils.getRegions()) {
regionNames.add(region.getName());
}
final ListBoxModel model = new ListBoxModel();
for (final String regionName : regionNames) {
model.add(new ListBoxModel.Option(regionName, regionName));
}
return model;
}