-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathregion.go
More file actions
71 lines (67 loc) · 1.75 KB
/
Copy pathregion.go
File metadata and controls
71 lines (67 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package snowflake
import "slices"
// Continents, from largest to smallest.
// Region codes are sourced from multiple cloud providers:
// - Fly.io: https://fly.io/docs/reference/regions/
// - AWS RDS: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.RegionsAndAvailabilityZones.md
// - Scaleway: https://www.scaleway.com/en/docs/account/reference-content/products-availability/
var continents = [][]string{
// Asia
{
// Fly.io
"bom", "hkg", "nrt", "sin",
// AWS RDS
"ap-east-1", "ap-east-2", "ap-northeast-1", "ap-northeast-2", "ap-northeast-3",
"ap-south-1", "ap-south-2", "ap-southeast-1", "ap-southeast-3", "ap-southeast-5",
"ap-southeast-7", "il-central-1", "me-central-1", "me-south-1",
},
// Africa
{
// Fly.io
"jnb",
// AWS RDS
"af-south-1",
},
// North America
{
// Fly.io
"atl", "bos", "den", "dfw", "ewr", "iad", "lax", "mia", "ord", "phx", "sea", "sjc", "yul", "yyz",
// AWS RDS
"ca-central-1", "ca-west-1", "mx-central-1", "us-east-1", "us-east-2",
"us-gov-east-1", "us-gov-west-1", "us-west-1", "us-west-2",
},
// South America
{
// Fly.io
"bog", "eze", "gdl", "gig", "gru", "qro", "scl",
// AWS RDS
"sa-east-1",
},
// Antarctica
{},
// Europe
{
// Fly.io
"ams", "arn", "cdg", "fra", "lhr", "mad", "otp", "waw",
// AWS RDS
"eu-central-1", "eu-central-2", "eu-north-1", "eu-south-1", "eu-south-2",
"eu-west-1", "eu-west-2", "eu-west-3",
// Scaleway
"fr-par", "par", "nl-ams", "ams", "pl-waw", "waw",
},
// Australia / Oceania
{
// Fly.io
"syd",
// AWS RDS
"ap-southeast-2", "ap-southeast-4", "ap-southeast-6",
},
}
func GetContinentCode(region string) int64 {
for i := range continents {
if slices.Contains(continents[i], region) {
return int64(i)
}
}
return -1
}