90bed67126
Change-Id: I423ad03e63bd38aded3abfcba49079ff2fbb3b74 Signed-off-by: Li Yi <denverdino@gmail.com>
56 lines
1.4 KiB
Go
56 lines
1.4 KiB
Go
package common
|
|
|
|
// Region represents ECS region
|
|
type Region string
|
|
|
|
// Constants of region definition
|
|
const (
|
|
Hangzhou = Region("cn-hangzhou")
|
|
Qingdao = Region("cn-qingdao")
|
|
Beijing = Region("cn-beijing")
|
|
Hongkong = Region("cn-hongkong")
|
|
Shenzhen = Region("cn-shenzhen")
|
|
Shanghai = Region("cn-shanghai")
|
|
Zhangjiakou = Region("cn-zhangjiakou")
|
|
Huhehaote = Region("cn-huhehaote")
|
|
|
|
APSouthEast1 = Region("ap-southeast-1")
|
|
APNorthEast1 = Region("ap-northeast-1")
|
|
APSouthEast2 = Region("ap-southeast-2")
|
|
APSouthEast3 = Region("ap-southeast-3")
|
|
APSouthEast5 = Region("ap-southeast-5")
|
|
|
|
APSouth1 = Region("ap-south-1")
|
|
|
|
USWest1 = Region("us-west-1")
|
|
USEast1 = Region("us-east-1")
|
|
|
|
MEEast1 = Region("me-east-1")
|
|
|
|
EUCentral1 = Region("eu-central-1")
|
|
EUWest1 = Region("eu-west-1")
|
|
|
|
ShenZhenFinance = Region("cn-shenzhen-finance-1")
|
|
ShanghaiFinance = Region("cn-shanghai-finance-1")
|
|
)
|
|
|
|
var ValidRegions = []Region{
|
|
Hangzhou, Qingdao, Beijing, Shenzhen, Hongkong, Shanghai, Zhangjiakou, Huhehaote,
|
|
USWest1, USEast1,
|
|
APNorthEast1, APSouthEast1, APSouthEast2, APSouthEast3, APSouthEast5,
|
|
APSouth1,
|
|
MEEast1,
|
|
EUCentral1, EUWest1,
|
|
ShenZhenFinance, ShanghaiFinance,
|
|
}
|
|
|
|
// IsValidRegion checks if r is an Ali supported region.
|
|
func IsValidRegion(r string) bool {
|
|
for _, v := range ValidRegions {
|
|
if r == string(v) {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|