435c0d9fc8
This PR switches the Nomad repository from using govendor to Go modules for managing dependencies. Aspects of the Nomad workflow remain pretty much the same. The usual Makefile targets should continue to work as they always did. The API submodule simply defers to the parent Nomad version on the repository, keeping the semantics of API versioning that currently exists.
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
|
|
}
|