diff --git a/region.go b/region.go index d226892..43f7956 100644 --- a/region.go +++ b/region.go @@ -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"): @@ -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) } @@ -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 diff --git a/region_test.go b/region_test.go index 8bc8a3b..2340d5e 100644 --- a/region_test.go +++ b/region_test.go @@ -29,7 +29,7 @@ func TestGetRegion(t *testing.T) { { "Dallas 12", args{"dal12"}, - "dal", + "us-south", false, }, { @@ -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, }, { @@ -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) {