Skip to content

Commit 0b4b587

Browse files
Add more GCP regions and locations
1 parent 7ee4612 commit 0b4b587

File tree

1 file changed

+43
-8
lines changed

1 file changed

+43
-8
lines changed

backend/src/region.rs

Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,41 @@ use strum_macros::{Display, EnumIter, EnumString};
1212
pub enum Region {
1313
Unset,
1414
Unknown,
15+
AfricaSouth1,
1516
AsiaEast1,
1617
AsiaEast2,
1718
AsiaNortheast1,
19+
AsiaNortheast2,
1820
AsiaNortheast3,
1921
AsiaSouth1,
22+
AsiaSouth2,
2023
AsiaSoutheast1,
2124
AsiaSoutheast2,
22-
AustralianSoutheast2,
25+
AustraliaSoutheast1,
26+
AustraliaSoutheast2,
27+
EuropeCentral2,
2328
EuropeNorth1,
29+
EuropeSouthwest1,
2430
EuropeWest1,
2531
EuropeWest2,
2632
EuropeWest3,
2733
EuropeWest4,
2834
EuropeWest6,
35+
EuropeWest8,
36+
EuropeWest9,
37+
EuropeWest12,
38+
MeCentral1,
39+
MeCentral2,
40+
MeWest1,
2941
NorthamericaNortheast1,
42+
NorthamericaNortheast2,
43+
NorthamericaSouth1,
3044
SouthamericaEast1,
45+
SouthamericaWest1,
3146
UsCentral1,
3247
UsEast1,
3348
UsEast4,
49+
UsSouth1,
3450
UsWest1,
3551
UsWest2,
3652
UsWest3,
@@ -40,38 +56,57 @@ pub enum Region {
4056
// Google sometimes calls this "location"
4157
#[derive(PartialEq)]
4258
enum GlobalArea {
59+
Africa,
4360
AsiaPacific,
61+
Australia, // GCP considers Australia part of AsiaPacific
4462
Europe,
45-
NorthAmerica,
46-
SouthAmerica,
63+
NorthAmerica, // GCP considers NorthAmerica part of Americas
64+
MiddleEast,
65+
SouthAmerica, // GCP considers SouthAmerica part of Americas
4766
}
4867

4968
impl Region {
5069
fn area(&self) -> Option<GlobalArea> {
5170
match self {
71+
Region::AfricaSouth1 => Some(GlobalArea::Africa),
5272
Region::AsiaEast1
5373
| Region::AsiaEast2
5474
| Region::AsiaNortheast1
75+
| Region::AsiaNortheast2
5576
| Region::AsiaNortheast3
5677
| Region::AsiaSouth1
78+
| Region::AsiaSouth2
5779
| Region::AsiaSoutheast1
58-
| Region::AsiaSoutheast2
59-
| Region::AustralianSoutheast2 => Some(GlobalArea::AsiaPacific),
60-
Region::EuropeNorth1
80+
| Region::AsiaSoutheast2 => Some(GlobalArea::AsiaPacific),
81+
Region::AustraliaSoutheast1 | Region::AustraliaSoutheast2 => {
82+
Some(GlobalArea::Australia)
83+
}
84+
Region::EuropeCentral2
85+
| Region::EuropeNorth1
86+
| Region::EuropeSouthwest1
6187
| Region::EuropeWest1
6288
| Region::EuropeWest2
6389
| Region::EuropeWest3
6490
| Region::EuropeWest4
65-
| Region::EuropeWest6 => Some(GlobalArea::Europe),
91+
| Region::EuropeWest6
92+
| Region::EuropeWest8
93+
| Region::EuropeWest9
94+
| Region::EuropeWest12 => Some(GlobalArea::Europe),
95+
Region::MeCentral1 | Region::MeCentral2 | Region::MeWest1 => {
96+
Some(GlobalArea::MiddleEast)
97+
}
6698
Region::NorthamericaNortheast1
99+
| Region::NorthamericaNortheast2
100+
| Region::NorthamericaSouth1
67101
| Region::UsCentral1
68102
| Region::UsEast1
69103
| Region::UsEast4
104+
| Region::UsSouth1
70105
| Region::UsWest1
71106
| Region::UsWest2
72107
| Region::UsWest3
73108
| Region::UsWest4 => Some(GlobalArea::NorthAmerica),
74-
Region::SouthamericaEast1 => Some(GlobalArea::SouthAmerica),
109+
Region::SouthamericaEast1 | Region::SouthamericaWest1 => Some(GlobalArea::SouthAmerica),
75110
Region::Unset | Region::Unknown => None,
76111
}
77112
}

0 commit comments

Comments
 (0)