Debian Codegraph @

common/regions.go

raw symbols SCIP
1 package common
2
3 // Region represents ECS region
4 type Region string
5
6 // Constants of region definition
7 const (
8 Hangzhou = Region("cn-hangzhou")
9 Qingdao = Region("cn-qingdao")
10 Beijing = Region("cn-beijing")
11 Hongkong = Region("cn-hongkong")
12 Shenzhen = Region("cn-shenzhen")
13 Shanghai = Region("cn-shanghai")
14 Zhangjiakou = Region("cn-zhangjiakou")
15 Huhehaote = Region("cn-huhehaote")
16
17 APSouthEast1 = Region("ap-southeast-1")
18 APNorthEast1 = Region("ap-northeast-1")
19 APSouthEast2 = Region("ap-southeast-2")
20 APSouthEast3 = Region("ap-southeast-3")
21 APSouthEast5 = Region("ap-southeast-5")
22
23 APSouth1 = Region("ap-south-1")
24
25 USWest1 = Region("us-west-1")
26 USEast1 = Region("us-east-1")
27
28 MEEast1 = Region("me-east-1")
29
30 EUCentral1 = Region("eu-central-1")
31
32 ShenZhenFinance = Region("cn-shenzhen-finance-1")
33 ShanghaiFinance = Region("cn-shanghai-finance-1")
34 )
35
36 var ValidRegions = []Region{
37 Hangzhou, Qingdao, Beijing, Shenzhen, Hongkong, Shanghai, Zhangjiakou, Huhehaote,
38 USWest1, USEast1,
39 APNorthEast1, APSouthEast1, APSouthEast2, APSouthEast3, APSouthEast5,
40 APSouth1,
41 MEEast1,
42 EUCentral1,
43 ShenZhenFinance, ShanghaiFinance,
44 }
45
46 // IsValidRegion checks if r is an Ali supported region.
47 func IsValidRegion(r string) bool {
48 for _, v := range ValidRegions {
49 if r == string(v) {
50 return true
51 }
52 }
53 return false
54 }