Skip to content

Commit

Permalink
PowerVS: Support newly added regions
Browse files Browse the repository at this point in the history
There are a bunch of new regions added to PowerVS.
  • Loading branch information
hamzy committed Jan 5, 2024
1 parent bc42a58 commit 1966848
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 1 deletion.
27 changes: 26 additions & 1 deletion region.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ func GetRegion(zone string) (region string, err error) {
region = "osa"
case strings.HasPrefix(zone, "mon"):
region = "mon"
case strings.HasPrefix(zone, "mad"):
region = "mad"
case strings.HasPrefix(zone, "wdc"):
region = "wdc"
default:
return "", fmt.Errorf("region not found for the zone, talk to the developer to add the support into the tool: %s", zone)
}
Expand Down Expand Up @@ -70,6 +74,15 @@ var Regions = map[string]Region{
"lon06",
},
},
"mad": {
Description: "Madrid, Spain",
VPCRegion: "eu-es",
COSRegion: "eu-es",
Zones: []string{
"mad02",
"mad04",
},
},
"mon": {
Description: "Montreal, Canada",
VPCRegion: "ca-tor",
Expand All @@ -95,7 +108,10 @@ var Regions = map[string]Region{
Description: "São Paulo, Brazil",
VPCRegion: "br-sao",
COSRegion: "br-sao",
Zones: []string{"sao01"},
Zones: []string{
"sao01",
"sao04",
},
},
"tok": {
Description: "Tokyo, Japan",
Expand All @@ -109,6 +125,15 @@ var Regions = map[string]Region{
COSRegion: "us-east",
Zones: []string{"us-east"},
},
"wdc": {
Description: "Washington DC, USA",
VPCRegion: "us-east",
COSRegion: "us-east",
Zones: []string{
"wdc06",
"wdc07",
},
},
}

// VPCRegionForPowerVSRegion returns the VPC region for the specified PowerVS region.
Expand Down
30 changes: 30 additions & 0 deletions region_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,30 @@ func TestGetRegion(t *testing.T) {
"sao",
false,
},
{
"Sao Paulo 04",
args{"sao04"},
"sao",
false,
},
{
"Washington DC",
args{"us-east"},
"us-east",
false,
},
{
"Washington DC 06",
args{"wdc06"},
"wdc",
false,
},
{
"Washington DC 07",
args{"wdc07"},
"wdc",
false,
},
{
"Toronto",
args{"tor01"},
Expand Down Expand Up @@ -86,6 +104,18 @@ func TestGetRegion(t *testing.T) {
"osa",
false,
},
{
"Madrid 02",
args{"mad02"},
"mad",
false,
},
{
"Madrid 04",
args{"mad04"},
"mad",
false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down

0 comments on commit 1966848

Please sign in to comment.