Skip to content

Commit

Permalink
update regions and zones
Browse files Browse the repository at this point in the history
  • Loading branch information
arshadd-b committed Nov 19, 2024
1 parent 1c0d75a commit b8b8a24
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
24 changes: 17 additions & 7 deletions region.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@ func GetRegion(zone string) (region string, err error) {
case strings.HasPrefix(zone, "us-south"):
region = "us-south"
case strings.HasPrefix(zone, "dal"):
region = "dal"
region = "us-south"
case strings.HasPrefix(zone, "sao"):
region = "sao"
case strings.HasPrefix(zone, "us-east"):
region = "us-east"
case strings.HasPrefix(zone, "tor"):
region = "tor"
case strings.HasPrefix(zone, "eu-de-"):
region = "eu-de"
case strings.HasPrefix(zone, "lon"):
Expand All @@ -33,9 +31,11 @@ func GetRegion(zone string) (region string, err error) {
case strings.HasPrefix(zone, "mad"):
region = "mad"
case strings.HasPrefix(zone, "wdc"):
region = "wdc"
region = "us-east"
case strings.HasPrefix(zone, "tor"):
region = "tor"
case strings.HasPrefix(zone, "che"):
region = "che"
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 @@ -95,7 +95,7 @@ var Regions = map[string]Region{
"mad02",
"mad04",
},
SysTypes: []string{"s1022"},
SysTypes: []string{"s1022", "e980"},
VPCZones: []string{"eu-es-1", "eu-es-2", "eu-es-3"},
},
"mon": {
Expand Down Expand Up @@ -141,7 +141,7 @@ var Regions = map[string]Region{
VPCRegion: "jp-tok",
COSRegion: "jp-tok",
Zones: []string{"tok04"},
SysTypes: []string{"s922", "e980"},
SysTypes: []string{"s922", "e980", "s1022"},
VPCZones: []string{"jp-tok-1", "jp-tok-2", "jp-tok-3"},
},
"tor": {
Expand All @@ -167,7 +167,7 @@ var Regions = map[string]Region{
Zones: []string{
"us-south",
},
SysTypes: []string{"s922", "e980"},
SysTypes: []string{"s922", "e980", "e880"},
VPCZones: []string{"us-south-1", "us-south-2", "us-south-3"},
},
"wdc": {
Expand All @@ -181,6 +181,16 @@ var Regions = map[string]Region{
SysTypes: []string{"s922", "e980"},
VPCZones: []string{"us-east-1", "us-east-2", "us-east-3"},
},
"che": {
Description: "Chennai, India",
VPCRegion: "",
COSRegion: "",
Zones: []string{
"che01",
},
SysTypes: []string{"s922", "e980"},
VPCZones: []string{},
},
}

// COSRegionForVPCRegion returns the corresponding COS region for the given VPC region
Expand Down
12 changes: 9 additions & 3 deletions region_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestGetRegion(t *testing.T) {
{
"Dallas 12",
args{"dal12"},
"dal",
"us-south",
false,
},
{
Expand All @@ -53,13 +53,13 @@ func TestGetRegion(t *testing.T) {
{
"Washington DC 06",
args{"wdc06"},
"wdc",
"us-east",
false,
},
{
"Washington DC 07",
args{"wdc07"},
"wdc",
"us-east",
false,
},
{
Expand Down Expand Up @@ -116,6 +116,12 @@ func TestGetRegion(t *testing.T) {
"mad",
false,
},
{
"Chennai",
args{"che01"},
"che",
false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down

0 comments on commit b8b8a24

Please sign in to comment.