-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Full implementation compiling. Probably doesn't work.
- Loading branch information
Showing
5 changed files
with
658 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#include <exception> | ||
#include <map> | ||
#include <string> | ||
#include "regionmap.hh" | ||
|
||
using std::domain_error; | ||
using std::map; | ||
using std::string; | ||
|
||
using Aws::Region; | ||
using Aws::String; | ||
|
||
namespace { | ||
class RegionMap { | ||
public: | ||
RegionMap(); | ||
map<String, Region> regions; | ||
}; | ||
|
||
RegionMap::RegionMap() { | ||
regions["us-east-1"] = Region::US_EAST_1; | ||
regions["us-west-1"] = Region::US_WEST_1; | ||
regions["us-west-2"] = Region::US_WEST_2; | ||
regions["eu-west-1"] = Region::EU_WEST_1; | ||
regions["eu-central-1"] = Region::EU_CENTRAL_1; | ||
regions["ap-southeast-1"] = Region::AP_SOUTHEAST_1; | ||
regions["ap-southeast-1"] = Region::AP_SOUTHEAST_2; | ||
regions["ap-northeast-1"] = Region::AP_NORTHEAST_1; | ||
regions["ap-northeast-2"] = Region::AP_NORTHEAST_2; | ||
regions["sa-east-1"] = Region::SA_EAST_1; | ||
return; | ||
} | ||
} | ||
|
||
Region getRegionForName(String const &name) { | ||
static RegionMap regionMap; | ||
auto pos = regionMap.regions.find(name); | ||
if (pos == regionMap.regions.end()) { | ||
throw domain_error("Unknown region " + string(name.c_str())); | ||
} | ||
|
||
return pos->second; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#pragma once | ||
#include <aws/core/Aws.h> | ||
#include <aws/core/Region.h> | ||
|
||
Aws::Region getRegionForName(Aws::String const &name); |
Oops, something went wrong.